From mboxrd@z Thu Jan  1 00:00:00 1970
From: Kyle Meyer <kyle@kyleam.com>
Subject: Re: can I refile or archive from the agenda without rebuilding?
Date: Tue, 16 Dec 2014 15:46:46 -0500
Message-ID: <87ppbj5nm1.fsf@kyleam.com>
References: <m2d27p807i.fsf@charm-wifi.irisa.fr> <87egs4u7j4.fsf@kyleam.com>
	<m2mw6r7vuv.fsf@charm-wifi.irisa.fr>
	<87y4q9tiug.fsf@konixwork.incubateur.ens-lyon.fr>
	<m2h9wwnebk.fsf@polytechnique.org>
Mime-Version: 1.0
Content-Type: text/plain
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42175)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kyle@kyleam.com>) id 1Y0z1E-0004ka-FI
	for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 15:47:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kyle@kyleam.com>) id 1Y0z18-0000XP-4D
	for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 15:46:56 -0500
Received: from mail-qc0-f175.google.com ([209.85.216.175]:44714)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kyle@kyleam.com>) id 1Y0z18-0000XD-0O
	for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 15:46:50 -0500
Received: by mail-qc0-f175.google.com with SMTP id b13so12277301qcw.34
	for <emacs-orgmode@gnu.org>; Tue, 16 Dec 2014 12:46:48 -0800 (PST)
In-Reply-To: <m2h9wwnebk.fsf@polytechnique.org> (Alan Schmitt's message of
	"Tue, 16 Dec 2014 10:17:51 +0100")
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>, Samuel Loury <konubinix@gmail.com>

Alan Schmitt <alan.schmitt@polytechnique.org> wrote:
> On 2014-12-15 09:31, Samuel Loury <konubinix@gmail.com> writes:
[...]
> 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

You could also use

    (define-key org-agenda-mode-map [remap org-agenda-refile]
      'as/org-agenda-refile-noupdate)

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

I usually prefer to define a new function because it allows you to use
both the old and new variant.

--
Kyle