emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: org-mode <emacs-orgmode@gnu.org>
Subject: Re: Question: org-remember and level>1 target headline [resent]
Date: Thu, 27 May 2010 11:43:17 +0200	[thread overview]
Message-ID: <4BFE3EB5.6020709@os.inf.tu-dresden.de> (raw)
In-Reply-To: <0F371155-B899-48C1-8D57-5F753807C19B@gmail.com>

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

[resending to get into the patch tracker]

Hi,

On 15.05.2010 08:42, Carsten Dominik wrote:
> On May 14, 2010, at 5:42 AM, Samuel Wales wrote:
>> On 2010-05-13, Martin Pohlack<mp26@os.inf.tu-dresden.de>  wrote:
>>> Is there interest to define remember targets via paths or via ID?
>>
>> ID would be useful, I think.
>
> ID certainly - path could be useful to avoid ambiguities.

Please find attached a first version of a patch adding support for IDs
as remember targets.

Feedback welcome.

Cheers,
Martin

[-- Attachment #2: org-remember-id.diff --]
[-- Type: text/x-patch, Size: 2252 bytes --]

This patch adds support for specifying the ID of a target headline.

Open issues:
* Using a cons cell seems a bit ugly.  A string would be fine too but
  this is already used by the headline itself in the choice element.
* The visual appearance of the ID choice is suboptimal.  Is there any
  way to hide the const visually?
* The comments in the remember buffer seems to be setup wrong, where
  must I hook in to support IDs there?

diff --git a/home/mpohlack/src/org-mode/lisp/org-remember.el b/org-remember.el
index 59e015f..a0dbac4 100644
--- a/home/mpohlack/src/org-mode/lisp/org-remember.el
+++ b/org-remember.el
@@ -108,7 +108,8 @@ An optional fifth element can specify the headline in that file that should
 be offered first when the user is asked to file the entry.  The default
 headline is given in the variable `org-remember-default-headline'.  When
 this element is `top' or `bottom', the note will be placed as a level-1
-entry at the beginning or end of the file, respectively.
+entry at the beginning or end of the file, respectively.  You can also specify
+the `ID' of a target headline.
 
 An optional sixth element specifies the contexts in which the template
 will be offered to the user.  This element can be a list of major modes
@@ -195,7 +196,8 @@ calendar           |  %:type %:date"
 		 (const :tag "Use `org-remember-default-headline'" nil)
 		 (const :tag "At beginning of file" top)
 		 (const :tag "At end of file" bottom)
-		 (const :tag "In a date tree" date-tree))
+		 (const :tag "In a date tree" date-tree)
+                 (cons :tag "ID" (const :tag "" ID) (string :tag "ID")))
 		(choice :tag "Context"
 		 (const :tag "Use in all contexts" nil)
 		 (const :tag "Use in all contexts" t)
@@ -974,6 +976,10 @@ See also the variable `org-reverse-note-order'."
 		(org-datetree-find-date-create reference-date)
 		(setq reversed nil)
 		(setq org-goto-start-pos (point)))
+	       ((consp heading)
+		(setq org-goto-start-pos (org-find-entry-with-id (cdr heading)))
+                (when (not org-goto-start-pos)
+                  (error "Target headline with ID '%s' not found" (cdr heading))))
 	       ((and (stringp heading) (string-match "\\S-" heading))
 		(goto-char (point-min))
 		(if (re-search-forward



[-- Attachment #3: 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

  parent reply	other threads:[~2010-05-27  9:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 17:40 Question: org-remember and level>1 target headline Martin Pohlack
2010-05-11  9:18 ` Martin Pohlack
2010-05-13 15:48   ` Martin Pohlack
2010-05-13 17:26     ` Eric S Fraga
2010-05-14  3:42     ` Samuel Wales
2010-05-15  6:42       ` Carsten Dominik
2010-05-18 17:39         ` Martin Pohlack
2010-05-27  9:43         ` Martin Pohlack [this message]
2010-06-22 12:54           ` Question: org-remember and level>1 target headline [resent] Carsten Dominik
2010-06-22 13:38             ` Martin Pohlack
2010-06-22 13:43               ` Carsten Dominik
2010-06-22 13:44               ` Martin Pohlack

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=4BFE3EB5.6020709@os.inf.tu-dresden.de \
    --to=mp26@os.inf.tu-dresden.de \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).