From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pohlack Subject: Re: Question: org-remember and level>1 target headline [resent] Date: Thu, 27 May 2010 11:43:17 +0200 Message-ID: <4BFE3EB5.6020709@os.inf.tu-dresden.de> References: <4BE84503.3020008@os.inf.tu-dresden.de> <4BE920E9.5090109@os.inf.tu-dresden.de> <4BEC1F46.10205@os.inf.tu-dresden.de> <0F371155-B899-48C1-8D57-5F753807C19B@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050705060702020508090000" Return-path: Received: from [140.186.70.92] (port=33801 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHZcX-0007sw-S3 for emacs-orgmode@gnu.org; Thu, 27 May 2010 05:43:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHZcW-0004Bb-Lh for emacs-orgmode@gnu.org; Thu, 27 May 2010 05:43:21 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:59714) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHZcW-0004BK-GM for emacs-orgmode@gnu.org; Thu, 27 May 2010 05:43:20 -0400 In-Reply-To: <0F371155-B899-48C1-8D57-5F753807C19B@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: org-mode This is a multi-part message in MIME format. --------------050705060702020508090000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit [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 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 --------------050705060702020508090000 Content-Type: text/x-patch; name="org-remember-id.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="org-remember-id.diff" 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 --------------050705060702020508090000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --------------050705060702020508090000--