diff options
-rw-r--r-- | emacs/.emacs.d/init/ycp-complete.el | 4 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-grep.el | 3 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-org.el | 8 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-prog.el | 7 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-buffer.el | 1 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-org.el | 8 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-prog.el | 8 |
7 files changed, 30 insertions, 9 deletions
diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el index a27e980..e59bbfd 100644 --- a/emacs/.emacs.d/init/ycp-complete.el +++ b/emacs/.emacs.d/init/ycp-complete.el @@ -144,8 +144,8 @@ (define-key corfu-map [remap beginning-of-buffer] nil) (define-key corfu-map [remap end-of-buffer] nil) (my-keybind corfu-map - "C-j" 'corfu-insert - "<RET>" 'nil + "C-j" #'corfu-insert + "<RET>" nil "C-s" #'corfu-next "C-r" #'corfu-previous) (require 'my-corfu) diff --git a/emacs/.emacs.d/init/ycp-grep.el b/emacs/.emacs.d/init/ycp-grep.el index 715f643..3c784f0 100644 --- a/emacs/.emacs.d/init/ycp-grep.el +++ b/emacs/.emacs.d/init/ycp-grep.el @@ -81,9 +81,6 @@ "C-g" #'isearch-cancel ; instead of `isearch-abort' "M-/" #'isearch-complete "C-o" #'isearch-occur) - (my-keybind global-map - "C-s" 'isearch-forward-regexp - "C-r" 'isearch-backward-regexp) ) (my-package replace diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el index 75d36d7..edf2dca 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -2,6 +2,7 @@ ;;; the glorious org mode (my-package org + (require 'my-org) (my-keybind global-map "M-u" #'org-store-link "C-c a" #'org-agenda @@ -405,9 +406,10 @@ (org-defkey org-agenda-mode-map "2" #'my-org-agenda-priority-B) (org-defkey org-agenda-mode-map "3" #'my-org-agenda-priority-C) (with-eval-after-load "org-capture" - (advice-add 'org-capture-place-template - :around 'my-org-capture-place-template-dont-delete-windows)) - ) + (advice-add + 'org-capture-place-template + :around 'my-org-capture-place-template-dont-delete-windows)) + (advice-add 'org-insert-structure-template :after 'my-org-edit-special)) (my-package my-org (:delay 30) diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index 11c4f62..6392cf8 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -197,7 +197,9 @@ ;;; emacs-lisp mode (my-package elisp-mode - (my-keybind emacs-lisp-mode-map "C-c C-c" #'eval-buffer) + (:delay 10) + (my-keybind emacs-lisp-mode-map + "C-c C-c" #'eval-buffer) (add-hook 'emacs-lisp-mode-hook (lambda () (auto-fill-mode 1))) (setq print-length 1000) (my-keybind global-map @@ -213,6 +215,9 @@ 'emacs-lisp-mode))) ;; for deep recursion, e.g. in radix tree (setq max-specpdl-size 32000) + (require 'my-prog) + (my-keybind emacs-lisp-mode-map + "C-M-x" #'my-eval-defun-or-region) ) ;;; paredit diff --git a/emacs/.emacs.d/lisp/my/my-buffer.el b/emacs/.emacs.d/lisp/my/my-buffer.el index 63b16be..9c7da4a 100644 --- a/emacs/.emacs.d/lisp/my/my-buffer.el +++ b/emacs/.emacs.d/lisp/my/my-buffer.el @@ -104,6 +104,7 @@ With two prefixes: create a buffer of the chosen major mode." buffer-create-function is `my-buffer-create-scratch'.") (defun my-read-major-mode () + "Read a major-mode in a prompt" (intern (completing-read "Major mode: " diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el index 28c5354..9411f72 100644 --- a/emacs/.emacs.d/lisp/my/my-org.el +++ b/emacs/.emacs.d/lisp/my/my-org.el @@ -1013,5 +1013,13 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." (interactive "p") (my-org-vote-up (- points))) +;; used to add advice to `org-insert-structure-template'. +(require 'my-buffer) +(defun my-org-edit-special (type) + (when (equal type "src") + (insert (string-remove-suffix + "-mode" (prin1-to-string (my-read-major-mode))))) + (org-edit-special)) + (provide 'my-org) ;;; my-org.el ends here diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el index 309df2e..e38a866 100644 --- a/emacs/.emacs.d/lisp/my/my-prog.el +++ b/emacs/.emacs.d/lisp/my/my-prog.el @@ -434,5 +434,13 @@ left and the source buffer on the right. (unless (derived-mode-p 'haskell-mode 'c-mode 'c++-mode) (eglot-format-buffer)))) +;;; lisp +(defun my-eval-defun-or-region (&optional arg) + "Call `eval-region' if region is active, otherwise call `eval-defun'" + (interactive "P") + (if (region-active-p) + (eval-region (region-beginning) (region-end) t) + (eval-defun arg))) + (provide 'my-prog) ;;; my-prog.el ends here |