From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremie Juste Subject: Re: How to obtain the headline level from org-element-at-point Date: Sat, 8 Apr 2017 17:05:31 +0200 (CEST) Message-ID: <87tw5z0wjr.fsf@u-cergy.fr> References: <87fuhj2dbn.fsf@u-cergy.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwrvn-0003XY-Ex for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 11:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwrvj-0003og-AL for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 11:05:39 -0400 Received: from snowwhite.contactoffice.com ([212.3.242.89]:33598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cwrvj-0003nQ-4Q for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 11:05:35 -0400 In-Reply-To: (John Kitchin's message of "Sat, 8 Apr 2017 10:31:57 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: emacs-orgmode@gnu.org Hello, Thanks for the reply. > what do you mean it only considers level 1 headlines? It seems to work on= all headlines for me. I mean that interleave-mode doesn't find the pdf path if I use the following configuration. That is property at level 2 headline. * Literature=20=20 ** Notes for CS103 :PROPERTIES: :INTERLEAVE_PDF: cs103.pdf :END: > The email subject doesn't seem related to the body you can get the level = like this. I was thinking that the function looks at the property of level 1 level only. am I wrong ? I filed an issue https://github.com/rudolfochrist/interleave/issues/44 and the maintainer seems to have confirmed it. > (org-element-property :level (org-element-at-point)) Thanks for the command. I was hoping to understand more this issue with it. Will post a reply if I find anything interesting. Bests regards, Jeremie > > > > John > > ----------------------------------- > Professor John Kitchin=C2=A0 > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > > On Sat, Apr 8, 2017 at 10:17 AM, Jeremie Juste w= rote: > > Hello, >=20=20=20=20 > Interleave-mode https://github.com/rudolfochrist/interleave, is a ver= y convenient tool for writing notes in associated > with pdf. It uses org-mode for this purpose. >=20=20=20=20 > I recently noticed that in the case where I want to write notes for > multiple pdf in a singlie org file, I have to use the level 1 headline >=20=20=20=20 > * Notes for CS103 > =C2=A0 :PROPERTIES: > =C2=A0 :INTERLEAVE_PDF: cs103.pdf > =C2=A0 :END: > > I would like to have the possibility of using any headline level for > this purpose but my org-fu is weak. >=20=20=20=20 > I think it boils down to this function in interleave-mode mode where > (org-element-type headline) checks only for level 1 headline. > > #+BEGIN_SRC elisp > (defun interleave--headline-pdf-path (buffer) > =C2=A0 "Return the INTERLEAVE_PDF property of the current headline in= BUFFER." > (with-current-buffer buffer > =C2=A0 (save-excursion > =C2=A0 =C2=A0 (let ((headline (org-element-at-point))) > =C2=A0 =C2=A0 =C2=A0 (when (and (equal (org-element-type headline) 'h= eadline) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-en= try-get nil interleave--pdf-prop)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq interleave-multi-pdf-notes-file t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-entry-get nil interleave--pdf-prop))= )))) >=20=20=20=20 > #+END_SRC > > Can anyone see a way around it ? >=20=20=20=20 > Best regards, >=20=20=20=20 > Jeremie