emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] can I refile or archive from the agenda without rebuilding?


From: Alan Schmitt
Subject: Re: [O] can I refile or archive from the agenda without rebuilding?
Date: Tue, 16 Dec 2014 10:17:51 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (darwin)

On 2014-12-15 09:31, Samuel Loury <address@hidden> writes:

>>> org-agenda-refile takes a NO-UPDATE argument.  To set this
>>> interactively, you could advise org-agenda-refile (or wrap it in another
>>> command).
>>
>> This is a great suggestion, thanks! It works perfectly.
>
> For other readers to take advantage of the code, this is my
> implementation of the advise.
>
> (defun my/org-agenda-refile (orig &optional goto rfloc no-update)
>   (funcall orig goto rfloc t))
>
> (add-function :around
>                         (symbol-function 'org-agenda-refile)
>                         #'my/org-agenda-refile)

This is how I did it:

#+begin_src emacs-lisp
(defun as/org-agenda-refile-noupdate (&optional goto rfloc)
  "Call `org-agenda-refile' with arguments GOTO, RFLOC, and t."
  (interactive "P")
  (org-agenda-refile goto rfloc t))

(add-hook 'org-agenda-mode-hook
          (lambda ()
            (local-set-key (kbd "C-c C-w") 'as/org-agenda-refile-noupdate)))
#+end_src

I'm curious: is it better to use an advice or to redefine a function?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7

Attachment: signature.asc
Description: PGP signature


reply via email to

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