aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-25 10:17:11 +1000
committerYuchen Pei <id@ypei.org>2023-07-25 10:17:11 +1000
commit7ff3b9b69fe7cb726acadfa81f6a076be8b2af78 (patch)
tree8f12246ce3be574de0fcc869569fe177d7c9fbf3 /emacs/.emacs.d/lisp/my
parent47da5a2943308eb7f8e3b85c1088d6bd71006b04 (diff)
some minor fixes
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el1
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el18
2 files changed, 19 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index 1a3747e..b0af50f 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -401,6 +401,7 @@ With an prefix-arg, copy the file name relative to project root."
;; it can be hard to preserve balance in text mode
(setq-local electric-pair-preserve-balance nil)
(turn-on-auto-fill)
+ (visual-line-mode)
)
(defun my-find-file-line-number (orig filename &rest args)
diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el
index e03a91d..0fb7d9e 100644
--- a/emacs/.emacs.d/lisp/my/my-org.el
+++ b/emacs/.emacs.d/lisp/my/my-org.el
@@ -1182,5 +1182,23 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks."
(when (derived-mode-p 'prog-mode)
(number-to-string (org-current-line))))
+;; override `org-capture-set-plist'
+(defun my-org-capture-set-plist (entry)
+ "Initialize the property list for ENTRY from the template definition."
+ (setq org-capture-plist (copy-sequence (nthcdr 5 entry)))
+ (org-capture-put :key (car entry) :description (nth 1 entry)
+ :target (nth 3 entry))
+ (let ((txt (nth 4 entry)) (type (or (nth 2 entry) 'entry)))
+ (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt))))
+ ;; The template may be empty or omitted for special types.
+ ;; Here we insert the default templates for such cases.
+ (cond
+ ((eq type 'item) (setq txt "- %?"))
+ ((eq type 'checkitem) (setq txt "- [ ] %?"))
+ ((eq type 'table-line) (setq txt "| %? |"))
+ ;; >>> the overriding difference
+ ((member type '(nil entry)) (setq txt "* %?"))))
+ (org-capture-put :template txt :type type)))
+
(provide 'my-org)
;;; my-org.el ends here