emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Samuel Loury <konubinix@gmail.com>
Cc: Kyle Meyer <kyle@kyleam.com>, emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: can I refile or archive from the agenda without rebuilding?
Date: Tue, 16 Dec 2014 10:17:51 +0100	[thread overview]
Message-ID: <m2h9wwnebk.fsf@polytechnique.org> (raw)
In-Reply-To: <87y4q9tiug.fsf@konixwork.incubateur.ens-lyon.fr> (Samuel Loury's message of "Mon, 15 Dec 2014 09:31:19 +0100")

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

On 2014-12-15 09:31, Samuel Loury <konubinix@gmail.com> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

  reply	other threads:[~2014-12-16 17:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 13:30 can I refile or archive from the agenda without rebuilding? Alan Schmitt
2014-12-12 17:01 ` Kyle Meyer
2014-12-13  9:16   ` Alan Schmitt
2014-12-15  8:31     ` Samuel Loury
2014-12-16  9:17       ` Alan Schmitt [this message]
2014-12-16 20:46         ` Kyle Meyer
2014-12-17  9:34           ` Samuel Loury
2014-12-17 15:36           ` Alan Schmitt

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=m2h9wwnebk.fsf@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=konubinix@gmail.com \
    --cc=kyle@kyleam.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).