feat: Add notes helpers, magit keybindings, and phscroll
- Move `my-blog-publish`, `my-blog-preview`, and `my-note-push` from init-org.el to init-kbd-func.el for better organization - Add magit keybindings under C-x g prefix - Add phscroll package for better org table line wrapping - Remove visual-line-mode hook from gptel - Add Chinese word segmentation buffer to consult ignore list
This commit is contained in:
@@ -108,6 +108,43 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(interactive)
|
||||
(align-regexp (region-beginning) (region-end) "\\(\\s-*\\)::" 1 1 nil))
|
||||
|
||||
(defun my-blog-publish (&optional directory)
|
||||
"Publish blog , git add/commit/push , generate commit message."
|
||||
(interactive)
|
||||
(let* ((blog-dir (or directory
|
||||
(if *is-windows*
|
||||
"h:/emacs/hugo/this-is-my-blog/"
|
||||
"~/org/hugo/this-is-my-blog/")))
|
||||
(timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
|
||||
(default-directory blog-dir))
|
||||
(save-buffer)
|
||||
(message "Adding files...")
|
||||
(eshell-command "git add .")
|
||||
(message "Committing: %s" timestamp)
|
||||
(eshell-command (format "git commit -m \"Update: %s\"" timestamp))
|
||||
(message "Pushing to remote...")
|
||||
(let ((exit-code (eshell-command "git push")))
|
||||
(if (eq exit-code t)
|
||||
(message "Push may have failed or nothing to push, check *Messages* buffer for details")
|
||||
(message "Push successfully %s" timestamp)))))
|
||||
|
||||
(defun my-blog-preview ()
|
||||
"Save and preview blog."
|
||||
(interactive)
|
||||
(save-buffer)
|
||||
(let ((default-directory (if *is-windows*
|
||||
"h:/emacs/hugo/this-is-my-blog/"
|
||||
"~/org/hugo/this-is-my-blog/")))
|
||||
(start-process "hugo-server" "*hugo-server*"
|
||||
"hugo" "server" "-D" "--bind" "0.0.0.0" "--port" "1313")
|
||||
(sleep-for 2)
|
||||
(browse-url "http://localhost:1313")))
|
||||
|
||||
(defun my-note-push ()
|
||||
"Git add/commit/push notes in `~/org/my-org-note/', generate commit message."
|
||||
(interactive)
|
||||
(my-blog-publish "~/org/my-org-note/"))
|
||||
|
||||
(defun my-dired-next-line()
|
||||
"Move to forward line in dired buffer"
|
||||
(interactive)
|
||||
@@ -188,11 +225,6 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(interactive)
|
||||
(load-file (expand-file-name "~/.emacs.d/lisp/fix-theme-colors.el")))
|
||||
|
||||
(defun my-note-push ()
|
||||
"Git add/commit/push notes in `~/org/my-org-note/', generate commit message."
|
||||
(interactive)
|
||||
(my-blog-publish "~/org/my-org-note/"))
|
||||
|
||||
(when *is-linux*
|
||||
(defun reboot ()
|
||||
"Execute loginctl reboot command."
|
||||
|
||||
Reference in New Issue
Block a user