From 18b47e2101ded569ff5e0c88813b0993f4f0ef8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Edstr=C3=B6m?= Date: Sat, 24 Aug 2024 13:24:56 +0200 Subject: [PATCH] style --- org-node-changes.el | 2 +- org-node.el | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/org-node-changes.el b/org-node-changes.el index 8161015..cb6ae87 100644 --- a/org-node-changes.el +++ b/org-node-changes.el @@ -41,7 +41,7 @@ Warn if any old name in `org-node-changes--new-names' is bound. Then copy the value in the old name so that the new name gets the same value." - ;; Bonus: a hook changed + ;; Bonus: a hook changed, warn if used in old way (cl-loop for fn in org-node-insert-link-hook when (and (help-function-arglist fn) diff --git a/org-node.el b/org-node.el index 013b417..a1a5c8c 100644 --- a/org-node.el +++ b/org-node.el @@ -80,12 +80,13 @@ ;; directory ;; TODO: Let series dispatch have another "level" for nav keys after selecting -;; the series, so "j" "n" "p" are available +;; the series, so "j" "n" "p", "c" are available (require 'cl-lib) (require 'subr-x) (require 'seq) (require 'transient) +(require 'bytecomp) (require 'persist) (require 'compat) (require 'dash) @@ -1785,8 +1786,9 @@ org-roam." (equal (org-node-get-title node) (org-get-heading t t t t))) (goto-char pos) - (org-show-context) - (org-show-entry) + (if (org-at-heading-p) + (org-show-entry) + (org-show-context)) (recenter 0))) (unless (pos-visible-in-window-p pos) (goto-char pos)))) @@ -2404,8 +2406,7 @@ Also add a corresponding entry to `org-node-series-dispatch'." (message "No capture template for series %s" (plist-get series :name)))) (setq org-node-current-series-key nil))) - (message "Choose series before navigating")))) - ]) + (message "Choose series before navigating"))))]) (defcustom org-node-series-that-marks-calendar nil "Key for the series that should mark days in the calendar. @@ -2795,7 +2796,7 @@ When called interactively, always prompt for confirmation. Internal argument INTERACTIVE is automatically set." (interactive "p" org-mode) - (let ((path (file-truename buffer-file-name)) + (let ((path buffer-file-truename) (buf (current-buffer)) (title nil)) (cond @@ -2814,7 +2815,8 @@ Internal argument INTERACTIVE is automatically set." (not (string-match-p org-node-renames-exclude path))) return t)) (if (not (setq title (or (cadar (org-collect-keywords '("TITLE"))) - ;; No title, take first heading as title + ;; No #+title, so take first heading as title + ;; for this purpose (save-excursion (without-restriction (goto-char 1) @@ -2920,8 +2922,9 @@ so it matches the destination\\='s current title." desc (org-node-get-aliases node)))) (switch-to-buffer (current-buffer)) (goto-char end) - (org-show-context) - (org-show-entry) + (if (org-at-heading-p) + (org-show-entry) + (org-show-context)) (recenter) (highlight-regexp exact-link 'org-node--rewrite-face) (unwind-protect @@ -3324,8 +3327,9 @@ one of them is associated with a ROAM_REFS." 'action `(lambda (_button) (org-id-goto ,origin) (goto-char ,pos) - (org-show-context) - (org-show-entry)) + (if (org-at-heading-p) + (org-show-entry) + (org-show-context))) 'face 'link 'follow-link t) origin)