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

2014-12-17 Thread Samuel Loury
Kyle Meyer k...@kyleam.com writes:

 Alan Schmitt alan.schm...@polytechnique.org wrote:
 On 2014-12-15 09:31, Samuel Loury konubi...@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.

That makes sense. Thanks for the advice (no pun intended).

-- 
Konubinix
GPG Key: 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A


signature.asc
Description: PGP signature


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

2014-12-17 Thread Alan Schmitt
On 2014-12-16 15:46, Kyle Meyer k...@kyleam.com writes:

 Alan Schmitt alan.schm...@polytechnique.org wrote:
 On 2014-12-15 09:31, Samuel Loury konubi...@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)

Thank you for this suggestion, it is most useful.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


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

2014-12-16 Thread Alan Schmitt
On 2014-12-15 09:31, Samuel Loury konubi...@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


signature.asc
Description: PGP signature


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

2014-12-16 Thread Kyle Meyer
Alan Schmitt alan.schm...@polytechnique.org wrote:
 On 2014-12-15 09:31, Samuel Loury konubi...@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



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

2014-12-15 Thread Samuel Loury
Alan Schmitt alan.schm...@polytechnique.org writes:

 On 2014-12-12 12:01, Kyle Meyer k...@kyleam.com writes:

 Alan Schmitt alan.schm...@polytechnique.org wrote:
 My agenda is fairly big, and it takes a few minutes to generate it.

 Wow.

 I meant seconds (about 20 seconds). But is feels like minutes ;)

I have the same feeling :-).

 When I need to refile many items to different places (so bulk edit is
 not an option), it slows me down quite a bit. Is there an option to
 prevent rebuilding the agenda after archiving or refiling?

 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.

--8---cut here---start-8---
(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)
--8---cut here---end---8---

My two cents,
-- 
Konubinix
GPG Key: 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A


signature.asc
Description: PGP signature


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

2014-12-13 Thread Alan Schmitt
On 2014-12-12 12:01, Kyle Meyer k...@kyleam.com writes:

 Alan Schmitt alan.schm...@polytechnique.org wrote:
 My agenda is fairly big, and it takes a few minutes to generate it.

 Wow.

I meant seconds (about 20 seconds). But is feels like minutes ;)

 When I need to refile many items to different places (so bulk edit is
 not an option), it slows me down quite a bit. Is there an option to
 prevent rebuilding the agenda after archiving or refiling?

 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.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


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

2014-12-12 Thread Alan Schmitt
Hello,

My agenda is fairly big, and it takes a few minutes to generate it. When
I need to refile many items to different places (so bulk edit is not an
option), it slows me down quite a bit. Is there an option to prevent
rebuilding the agenda after archiving or refiling?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


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

2014-12-12 Thread Kyle Meyer
Alan Schmitt alan.schm...@polytechnique.org wrote:
 My agenda is fairly big, and it takes a few minutes to generate it.

Wow.

 When I need to refile many items to different places (so bulk edit is
 not an option), it slows me down quite a bit. Is there an option to
 prevent rebuilding the agenda after archiving or refiling?

org-agenda-refile takes a NO-UPDATE argument.  To set this
interactively, you could advise org-agenda-refile (or wrap it in another
command).

-- 
Kyle