emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-link-search: Augment signature?
@ 2010-08-19 12:15 Jambunathan K
  2010-08-20  6:44 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Jambunathan K @ 2010-08-19 12:15 UTC (permalink / raw)
  To: emacs-orgmode


I have a small utility routine that depends on org-link-search to throw
an error. It knew how to create the missing headline on it's own.

A recent change and the default settings breaks the original behaviour.

Using this as pretext, may I suggest that signature of org-link-search
be changed from

(org-link-search S &optional TYPE AVOID-POS)

to

(org-link-search S &optional TYPE AVOID-POS NOERROR)

or an equivalent one.

ps: A cursory look suggests that the above change would also obviate the
need for dynamically binding org-link-search-inhibit-query.

Thanks,
Jambunathan K.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-link-search: Augment signature?
  2010-08-19 12:15 org-link-search: Augment signature? Jambunathan K
@ 2010-08-20  6:44 ` Carsten Dominik
       [not found]   ` <81fwy97id5.fsf@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2010-08-20  6:44 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode


On Aug 19, 2010, at 2:15 PM, Jambunathan K wrote:

>
> I have a small utility routine that depends on org-link-search to  
> throw
> an error. It knew how to create the missing headline on it's own.
>
> A recent change and the default settings breaks the original  
> behaviour.
>
> Using this as pretext, may I suggest that signature of org-link-search
> be changed from
>
> (org-link-search S &optional TYPE AVOID-POS)
>
> to
>
> (org-link-search S &optional TYPE AVOID-POS NOERROR)
>
> or an equivalent one.

I think a good solution for your utility would be to bind

(let ((org-link-search-must-match-exact-headline t))

around the body of the function.

>
> ps: A cursory look suggests that the above change would also obviate  
> the
> need for dynamically binding org-link-search-inhibit-query.

I am not sure if I understand this part.

- Carsten

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-link-search: Augment signature?
       [not found]     ` <2559B10D-71A8-46B9-9694-AE6332924768@gmail.com>
@ 2010-08-20  9:48       ` Jambunathan K
  0 siblings, 0 replies; 3+ messages in thread
From: Jambunathan K @ 2010-08-20  9:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

    >> On a related note, how would I accomplish this - "Create the
    >> headline automagically everytime but suppress the prompt".
    >> 
    >> This is the code snippet as it is in git today -
    >> 
    >> ((and (not org-link-search-inhibit-query) (eq
    >> org-link-search-must-match-exact-headline 'query-to-create)
    >> (y-or-n-p "No match - create this as a new heading? "))
    >> (goto-char (point-max)) (or (bolp) (newline)) (insert "* " s
    >> "\n") (beginning-of-line 0))
    >> 
    >> 
    >> Shouldn't the above block should instead read thus
    >> 
    >> ((and (eq org-link-search-must-match-exact-headline
    >> 'query-to-create) (or org-link-search-inhibit-query (y-or-n-p "No
    >> match - create this as a new heading? ")) (goto-char (point-max))
    >> (or (bolp) (newline)) (insert "* " s "\n") (beginning-of-line 0))


    > Why???

    > The above code would stop at the first form that returns nil, for
    > example (insert ...) or even (newline)


Mistake on my part. (Not a native speaker of elisp here)

((and
  (eq org-link-search-must-match-exact-headline 'query-to-create)
  (or org-link-search-inhibit-query
      (y-or-n-p "No match - create this as a new heading? ")))
 (goto-char (point-max))
 (or (bolp) (newline))
 (insert "* " s "\n")
 (beginning-of-line 0))

My gut feeling is that there is some inconsistency in the way
org-link-search-must-match-exact-headline and
org-link-search-inhibit-query work together.

Jambunathan K.





    

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-20 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-19 12:15 org-link-search: Augment signature? Jambunathan K
2010-08-20  6:44 ` Carsten Dominik
     [not found]   ` <81fwy97id5.fsf@gmail.com>
     [not found]     ` <2559B10D-71A8-46B9-9694-AE6332924768@gmail.com>
2010-08-20  9:48       ` Jambunathan K

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).