emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-orgmode@gnu.org
Cc: John Wiegley <johnw@newartisans.com>
Subject: Minor patch for org-attach.el
Date: Sun, 06 Feb 2022 17:21:52 -0500	[thread overview]
Message-ID: <jwvwni7y70r.fsf-monnier+emacs@gnu.org> (raw)

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	other threads:[~2022-02-06 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 22:21 Stefan Monnier [this message]
2022-02-06 23:02 ` Minor patch for org-attach.el Marco Wahl
2022-02-07  0:13   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwni7y70r.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=johnw@newartisans.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).