* Make archived headers unavailable as refile targets?
@ 2010-01-25 10:32 Paul Mead
2010-01-26 11:10 ` Carsten Dominik
0 siblings, 1 reply; 7+ messages in thread
From: Paul Mead @ 2010-01-25 10:32 UTC (permalink / raw)
To: emacs-orgmode
Hi
Is there any way of excluding archived headers as refile targets?
I'd like to restrict refiling to those projects which are current.
Thanks
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-25 10:32 Make archived headers unavailable as refile targets? Paul Mead
@ 2010-01-26 11:10 ` Carsten Dominik
2010-01-26 15:18 ` Paul Mead
0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2010-01-26 11:10 UTC (permalink / raw)
To: Paul Mead; +Cc: emacs-orgmode
On Jan 25, 2010, at 11:32 AM, Paul Mead wrote:
> Hi
>
> Is there any way of excluding archived headers as refile targets?
>
> I'd like to restrict refiling to those projects which are current.
Take a look at the variable `org-refile-target-verify-function'.
HTH
- Carsten
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-26 11:10 ` Carsten Dominik
@ 2010-01-26 15:18 ` Paul Mead
2010-01-26 16:10 ` David Maus
2010-01-26 16:27 ` Richard Riley
0 siblings, 2 replies; 7+ messages in thread
From: Paul Mead @ 2010-01-26 15:18 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode
2010/1/26 Carsten Dominik <carsten.dominik@gmail.com>:
>
> Take a look at the variable `org-refile-target-verify-function'.
>
> HTH
>
> - Carsten
>
>
Thanks Carsten, I've had a look at the variable and the customize
option for it and I'm afraid I don't understand how to use it for my
task. I'm afraid my elisp skills aren't up to much. Do I enter the
name of a function and defun it somewhere else?
I'm assuming that I write a function which tests whether a headline
has an ARCHIVE tag and return nil if that's the case - is that right?
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-26 15:18 ` Paul Mead
@ 2010-01-26 16:10 ` David Maus
2010-01-26 18:52 ` Paul Mead
2010-01-26 16:27 ` Richard Riley
1 sibling, 1 reply; 7+ messages in thread
From: David Maus @ 2010-01-26 16:10 UTC (permalink / raw)
To: paul.d.mead, Paul Mead; +Cc: emacs-orgmode, Carsten Dominik
[-- Attachment #1.1: Type: text/plain, Size: 841 bytes --]
Hi Paul,
At Tue, 26 Jan 2010 15:18:47 +0000,
Paul Mead wrote:
>
> 2010/1/26 Carsten Dominik <carsten.dominik@gmail.com>:
>
> >
> > Take a look at the variable `org-refile-target-verify-function'.
> >
> > HTH
> >
> > - Carsten
> >
> >
> Thanks Carsten, I've had a look at the variable and the customize
> option for it and I'm afraid I don't understand how to use it for my
> task. I'm afraid my elisp skills aren't up to much. Do I enter the
> name of a function and defun it somewhere else?
Yes, or you use the anonymous lambda declaration. Something like this:
(setq org-refile-target-verify-function
'(lambda ()
(if (member org-archive-tag (split-string (or (org-entry-get (point) "ALLTAGS") "") ":"))
nil t)))
HTH
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-26 15:18 ` Paul Mead
2010-01-26 16:10 ` David Maus
@ 2010-01-26 16:27 ` Richard Riley
2010-01-26 16:55 ` Richard Riley
1 sibling, 1 reply; 7+ messages in thread
From: Richard Riley @ 2010-01-26 16:27 UTC (permalink / raw)
To: emacs-orgmode
Paul Mead <paul.d.mead@googlemail.com> writes:
> 2010/1/26 Carsten Dominik <carsten.dominik@gmail.com>:
>
>>
>> Take a look at the variable `org-refile-target-verify-function'.
>>
>> HTH
>>
>> - Carsten
>>
>>
> Thanks Carsten, I've had a look at the variable and the customize
> option for it and I'm afraid I don't understand how to use it for my
> task. I'm afraid my elisp skills aren't up to much. Do I enter the
> name of a function and defun it somewhere else?
>
> I'm assuming that I write a function which tests whether a headline
> has an ARCHIVE tag and return nil if that's the case - is that right?
There might be easier ways, but as I'm familiarising myself more with
elisp, here's one solution:
,----
| (defun org-contains-tag (tag)
| (interactive)
| (let* ((tagslist (org-split-string (org-get-tags-string) ":")))
| (if tagslist (or (member tag tagslist) (member (upcase tag) tagslist)) nil)))
|
| (defun org-not-archived () (not (org-contains-tag "archive")))
|
| (setq org-refile-target-verify-function 'org-not-archived)
|
| ;; (global-set-key (kbd "C-c p") (lambda()(interactive)(message "Tag contains %s : %s" "archive" (if (org-contains-tag "archive")"yes" "no"))))
`----
regards
r.
>
> Paul
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
--
Google Talk : rileyrgdev@googlemail.com http://www.google.com/talk
ASCII ribbon campaign ( )
- against HTML email X
& vCards / \
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-26 16:27 ` Richard Riley
@ 2010-01-26 16:55 ` Richard Riley
0 siblings, 0 replies; 7+ messages in thread
From: Richard Riley @ 2010-01-26 16:55 UTC (permalink / raw)
To: emacs-orgmode
Richard Riley <rileyrgdev@gmail.com> writes:
> There might be easier ways, but as I'm familiarising myself more with
> elisp, here's one solution:
>
Having seen David's solution, I realised the org-archive-tag in your
case is better rather than the more "general" solution I aimed for. So
maintaining the general org-contains-tag solution but using the correct
tag variable:
,----
| (defun org-not-archived () (not (org-contains-tag org-archive-tag)))
`----
r.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make archived headers unavailable as refile targets?
2010-01-26 16:10 ` David Maus
@ 2010-01-26 18:52 ` Paul Mead
0 siblings, 0 replies; 7+ messages in thread
From: Paul Mead @ 2010-01-26 18:52 UTC (permalink / raw)
To: David Maus; +Cc: emacs-orgmode
Thanks David, I'm going to have to check out the elisp reference and
try to understand what you did there!
Paul
2010/1/26 David Maus <maus.david@gmail.com>:
> Hi Paul,
>
> At Tue, 26 Jan 2010 15:18:47 +0000,
> Paul Mead wrote:
>>
>> 2010/1/26 Carsten Dominik <carsten.dominik@gmail.com>:
>>
>> >
>> > Take a look at the variable `org-refile-target-verify-function'.
>> >
>> > HTH
>> >
>> > - Carsten
>> >
>> >
>> Thanks Carsten, I've had a look at the variable and the customize
>> option for it and I'm afraid I don't understand how to use it for my
>> task. I'm afraid my elisp skills aren't up to much. Do I enter the
>> name of a function and defun it somewhere else?
>
> Yes, or you use the anonymous lambda declaration. Something like this:
>
> (setq org-refile-target-verify-function
> '(lambda ()
> (if (member org-archive-tag (split-string (or (org-entry-get (point) "ALLTAGS") "") ":"))
> nil t)))
> HTH
>
> -- David
>
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... maus.david@gmail.com
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-01-26 18:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 10:32 Make archived headers unavailable as refile targets? Paul Mead
2010-01-26 11:10 ` Carsten Dominik
2010-01-26 15:18 ` Paul Mead
2010-01-26 16:10 ` David Maus
2010-01-26 18:52 ` Paul Mead
2010-01-26 16:27 ` Richard Riley
2010-01-26 16:55 ` Richard Riley
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).