From 7ff3b9b69fe7cb726acadfa81f6a076be8b2af78 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 25 Jul 2023 10:17:11 +1000 Subject: some minor fixes --- emacs/.emacs.d/init/ycp-editing.el | 1 + emacs/.emacs.d/init/ycp-org.el | 1 + emacs/.emacs.d/lisp/my/my-editing.el | 1 + emacs/.emacs.d/lisp/my/my-org.el | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+) (limited to 'emacs/.emacs.d') diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el index 1300ccb..b5da08a 100644 --- a/emacs/.emacs.d/init/ycp-editing.el +++ b/emacs/.emacs.d/init/ycp-editing.el @@ -41,6 +41,7 @@ ;; don't interpret C-m as RET (define-key input-decode-map [?\C-m] [C-m]) (setq save-place-file (locate-user-emacs-file "saveplace")) +(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) (my-package my-editing (:delay 5) diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el index d3c1d1e..72da862 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -206,6 +206,7 @@ ) (my-package org-capture + (my-override org-capture-set-plist) (setq org-capture-templates `(("j" "Journal" entry (file+olp+datetree ,(my-get-from-local my-org-journal-file)) 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 -- cgit v1.2.3