emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Minor patch for org-attach.el
@ 2022-02-06 22:21 Stefan Monnier
  2022-02-06 23:02 ` Marco Wahl
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2022-02-06 22:21 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: John Wiegley

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)



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-07  0:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 22:21 Minor patch for org-attach.el Stefan Monnier
2022-02-06 23:02 ` Marco Wahl
2022-02-07  0:13   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).