.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

commit 3cb25c298dc3b14a6ec43e49895c0c69e6a18a9a
parent a0275d064399a15c8af85bb4515ab8fb800cea5b
Author: andsy10 <andsy1016@gmail.com>
Date:   Sat, 26 Sep 2026 15:03:46 +0800

Update keybindings

Diffstat:
Mlisp/init-kbd-func.el | 11++++++-----
Mlisp/init-kbd.el | 30++++++++++++++++++++++--------
Mlisp/init-org.el | 24+++++++++++++++++++-----
Mlisp/init-package.el | 48+++++++++++++++++++++++++++++++++++++++++++++++-
Mlisp/init-prog.el | 10++++++++++
5 files changed, 104 insertions(+), 19 deletions(-)

diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el @@ -13,11 +13,12 @@ "Switch to the *scratch* buffer. With a prefix ARG create a new *scratch* buffer." (interactive "P") - (if arg - (let ((buf (generate-new-buffer "*scratch*"))) - (switch-to-buffer buf) - (funcall initial-major-mode)) - (scratch-buffer))) + (let ((default-directory (expand-file-name "~/"))) + (if arg + (let ((buf (generate-new-buffer "*scratch*"))) + (switch-to-buffer buf) + (funcall initial-major-mode)) + (scratch-buffer)))) ;; from Bozhidar Batsov's crux (defun my-kill-line-backwards () diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el @@ -122,6 +122,7 @@ "d" #'denote "D" #'denote-date "r" #'denote-rename-file-date + "b" #'my-denote-find-backlink-with-location "R" #'denote-rename-file "m" #'my-denote-open-metanote "q" #'org-ql-search) @@ -142,10 +143,12 @@ :prefix "C-c m" "n" #'emms-next "p" #'emms-previous - "b" #'emms-browser + "f" #'emms-seek-forward + "b" #'emms-seek-backward + "B" #'emms-browser "s" #'emms-start "q" #'emms-stop - "P" #'emms-pause + "SPC" #'emms-pause "S" #'emms-toggle-single-track "l" #'emms-playlist-mode-switch-buffer "d" #'emms-play-directory) @@ -203,6 +206,7 @@ "b" #'dired-up-directory "C-b" #'backward-char "C-f" #'forward-char + "K" #'dired-kill-line "<right>" #'dired-find-file "<left>" #'dired-up-directory "C-/" #'dired-undo @@ -247,6 +251,10 @@ "C-p" #'sly-previous-note "C-n" #'sly-next-note) +(general-def sly-mrepl-mode-map + "M-p" #'sly-mrepl-previous-input-or-button + "M-n" #'sly-mrepl-next-input-or-button) + ;; ghostel (general-def (ghostel-mode-map ghostel-semi-char-mode-map @@ -280,7 +288,8 @@ ;; markdown (general-def markdown-mode-map "M-p" nil - "M-n" nil) + "M-n" nil + "C-<tab>" #'markdown-cycle-parent-subtree) ;; org-mode (general-def org-mode-map @@ -291,9 +300,8 @@ "M-{" #'backward-paragraph "M-}" #'forward-paragraph "C-," #'my-duplicate-current-line-or-region - "C-c o l" #'denote-link + "C-c o l" #'denote-link-or-create "C-c o L" #'denote-org-link-to-heading - "C-c o b" #'my-denote-find-backlink-with-location "C-c o B" #'my-denote-org-find-backlink-for-heading-with-location "C-c o t" #'my-org-tree-slide-start) @@ -325,13 +333,16 @@ (general-def emms-playlist-mode-map "<prior>" #'emms-previous "<next>" #'emms-next - "C-c C-s" #'emms-history-save) + "C-c C-s" #'emms-history-save + "SPC" #'emms-pause + "<left>" #'emms-seek-backward + "<right>" #'emms-seek-forward) ;; perspective (general-def persp-mode-map "C-c p c" nil "C-c p d" #'persp-kill - "C-x M-b" #'persp-ibuffer) + "C-x C-b" #'persp-ibuffer) ;; info (general-def Info-mode-map @@ -426,7 +437,10 @@ ;; other "C-x r b" #'consult-bookmark "C-;" #'embark-act - "M-s M-b" #'eww-list-bookmarks) + "M-s M-b" #'eww-list-bookmarks + "<f8>" #'emms-pause + "<f7>" #'emms-previous + "<f9>" #'emms-next) (cond (*is-android* diff --git a/lisp/init-org.el b/lisp/init-org.el @@ -102,20 +102,24 @@ :hook (after-init . denote-rename-buffer-mode) (dired-mode . denote-dired-mode) + :commands my-denote-find-file my-denote-find-backlink-with-location :config (defun my-denote-find-file (&optional arg) "Find file use denote-open-or-create." (interactive "P") - (let ((denote-excluded-files-regexp (if arg nil (concat denote-excluded-files-regexp "\\|=journal")))) + (let ((denote-excluded-files-regexp + (unless arg (concat denote-excluded-files-regexp "\\|==" denote-journal-signature)))) (call-interactively #'denote-open-or-create))) (defun my-denote-find-backlink-with-location () "Like `denote-find-backlink-with-location' but with consult preview." (interactive) - (when-let* ((current-file buffer-file-name) + (when-let* ((current-file (or buffer-file-name + (and (derived-mode-p 'dired-mode) + (dired-get-filename nil t)))) (id (or (denote-retrieve-filename-identifier current-file) (user-error "The current file does not have a Denote identifier"))) - (files (denote-directory-files nil :omit-current :text-only)) + (files (delete current-file (denote-directory-files nil nil :text-only))) (fetcher (lambda () (xref-matches-in-files id files)))) (consult-xref fetcher nil))) @@ -134,7 +138,7 @@ ;; denote-org (use-package denote-org - :autoload my-denote-org-find-backlink-for-heading-with-location + :commands my-denote-org-find-backlink-for-heading-with-location :config (defun my-denote-org-find-backlink-for-heading-with-location () "Like `denote-org-backlinks-for-heading' but with consult preview." @@ -198,7 +202,17 @@ (setq denote-journal-keyword "daily")) ;; denote-explore -(use-package denote-explore) +(use-package denote-explore + :commands my-denote-explore-isolate-files-dired + :config + (defun my-denote-explore-isolate-files-dired () + "Identify Denote files without (back)links." + (interactive) + (let ((denote-excluded-directories-regexp + (file-name-nondirectory (directory-file-name denote-journal-directory)))) + (dired (cons "notes" + (mapcar (lambda (file) (car file)) + (denote-explore--idenitfy-isolated))))))) ;; consult-denote (use-package consult-denote diff --git a/lisp/init-package.el b/lisp/init-package.el @@ -72,6 +72,24 @@ Like normal Emacs `C-k'. Kill to end of line and put content in kill-ring." :hook (after-init . persp-mode) :config + (defun persp-ibuffer (arg) + "Invoke IBUFFER with a configuration enabled for Perspective. +With a prefix arg, show buffers in all perspectives. +This respects ido-ignore-buffers, since we automatically add +buffer filtering to ido-mode already (see use of +PERSP-SET-IDO-BUFFERS)." + (interactive "P") + (unless (featurep 'ibuffer) + (require 'ibuffer)) + (defvar ibuffer-maybe-show-predicates) + (if (and persp-mode (null arg)) + (let ((ibuffer-maybe-show-predicates (append ibuffer-maybe-show-predicates + (list #'(lambda (buf) (persp-buffer-filter buf t))) + (list #'(lambda (buf) + (persp--ignore-buffer-p (buffer-name buf))))))) + (ibuffer)) + (ibuffer))) + (defun my-persp-remove-marked-ibuffers () "Remove marked buffers from perspective." (interactive) @@ -221,7 +239,35 @@ against its previous revision." ([remap describe-key] . helpful-key) ([remap describe-symbol] . helpful-symbol) :map helpful-mode-map - ("r" . remove-hook-at-point))) + ("R" . remove-hook-at-point)) + :config + (defun remove-hook-at-point () + "Remove the hook at the point in the *Help* buffer." + (interactive) + (unless (memq major-mode '(help-mode helpful-mode)) + (error "Only for help-mode or helpful-mode")) + (let ((orig-point (point))) + (save-excursion + (when-let* + ((hook (progn (goto-char (point-min)) (symbol-at-point))) + (func (when (and + (or (re-search-forward (format "^Value:?[\s|\n]") nil t) + (goto-char orig-point)) + (thing-at-point 'sexp)) + (thing-at-point--end-of-sexp) + (backward-char 1) + (catch 'break + (while t + (condition-case _err + (backward-sexp) + (scan-error (throw 'break nil))) + (let ((bounds (bounds-of-thing-at-point 'sexp))) + (when (<= (car bounds) orig-point (cdr bounds)) + (throw 'break (thing-at-point 'sexp))))))))) + (when (yes-or-no-p (format "Remove %s from %s? " func hook)) + (remove-hook hook (intern func)) + (if (memq major-mode '(helpful-mode)) + (helpful-update)))))))) ;; typing game (use-package typit) diff --git a/lisp/init-prog.el b/lisp/init-prog.el @@ -128,6 +128,16 @@ :hook (markdown-mode . visual-line-mode) :init + (defun markdown-cycle-parent-subtree() + "Cycle parent markdown subtree." + (interactive) + (if (markdown-on-heading-p) + (progn + (markdown-up-heading 1) + (markdown-cycle)) + (markdown-back-to-heading) + (markdown-cycle))) + (setq markdown-command "multimarkdown" markdown-fontify-code-blocks-natively t))