emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor patch for org-attach.el


From: Stefan Monnier
Subject: Minor patch for org-attach.el
Date: Sun, 06 Feb 2022 17:21:52 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Here's a patch which cleans up some magic numbers in
`org-attach.el` and gets rif of the use of the second arg of `commandp`,
by making `org-attach-commands` accept any commands (including keyboard
macros).


        Stefan


diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 36c21b7021..bba7fd7690 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -314,14 +314,14 @@ org-attach
                             (concat (mapcar #'caar org-attach-commands)))))
            (message msg)
            (while (and (setq c (read-char-exclusive))
-                       (memq c '(14 16 22 134217846)))
+                       (memq c '(?\C-n ?\C-p ?\C-v ?\M-v)))
              (org-scroll c t)))
          (and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
       (let ((command (cl-some (lambda (entry)
                                (and (memq c (nth 0 entry)) (nth 1 entry)))
                              org-attach-commands)))
-       (if (commandp command t)
-           (call-interactively command)
+       (if (commandp command)
+           (command-execute command)
          (error "No such attachment command: %c" c))))))
 
 (defun org-attach-dir (&optional create-if-not-exists-p no-fs-check)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]