emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to obtain the headline level from org-element-at-point
@ 2017-04-08 14:17 Jeremie Juste
  2017-04-08 14:31 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremie Juste @ 2017-04-08 14:17 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

Interleave-mode https://github.com/rudolfochrist/interleave, is a very convenient tool for writing notes in associated
with pdf. It uses org-mode for this purpose.

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

* Notes for CS103
  :PROPERTIES:
  :INTERLEAVE_PDF: cs103.pdf
  :END:


I would like to have the possibility of using any headline level for
this purpose but my org-fu is weak.

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)
  "Return the INTERLEAVE_PDF property of the current headline in BUFFER." 
(with-current-buffer buffer 
  (save-excursion 
    (let ((headline (org-element-at-point))) 
      (when (and (equal (org-element-type headline) 'headline) 
		 (org-entry-get nil interleave--pdf-prop)) 
	(setq interleave-multi-pdf-notes-file t) 
	(org-entry-get nil interleave--pdf-prop))))))

#+END_SRC


Can anyone see a way around it ?

Best regards,

Jeremie

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

* Re: How to obtain the headline level from org-element-at-point
  2017-04-08 14:17 How to obtain the headline level from org-element-at-point Jeremie Juste
@ 2017-04-08 14:31 ` John Kitchin
  2017-04-08 15:05   ` Jeremie Juste
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2017-04-08 14:31 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: emacs-orgmode@gnu.org

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

what do you mean it only considers level 1 headlines? It seems to work on
all headlines for me.

The email subject doesn't seem related to the body you can get the level
like this.

(org-element-property :level (org-element-at-point))

John

-----------------------------------
Professor John Kitchin
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 <jeremiejuste@gmail.com>
wrote:

>
> Hello,
>
> Interleave-mode https://github.com/rudolfochrist/interleave, is a very
> convenient tool for writing notes in associated
> with pdf. It uses org-mode for this purpose.
>
> 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
>
> * Notes for CS103
>   :PROPERTIES:
>   :INTERLEAVE_PDF: cs103.pdf
>   :END:
>
>
> I would like to have the possibility of using any headline level for
> this purpose but my org-fu is weak.
>
> 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)
>   "Return the INTERLEAVE_PDF property of the current headline in BUFFER."
> (with-current-buffer buffer
>   (save-excursion
>     (let ((headline (org-element-at-point)))
>       (when (and (equal (org-element-type headline) 'headline)
>                  (org-entry-get nil interleave--pdf-prop))
>         (setq interleave-multi-pdf-notes-file t)
>         (org-entry-get nil interleave--pdf-prop))))))
>
> #+END_SRC
>
>
> Can anyone see a way around it ?
>
> Best regards,
>
> Jeremie
>
>

[-- Attachment #2: Type: text/html, Size: 2668 bytes --]

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

* Re: How to obtain the headline level from org-element-at-point
  2017-04-08 14:31 ` John Kitchin
@ 2017-04-08 15:05   ` Jeremie Juste
  2017-04-08 15:31     ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremie Juste @ 2017-04-08 15:05 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

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  
     ** 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 
> 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 <jeremiejuste@gmail.com> wrote:
>
>     Hello,
>    
>     Interleave-mode https://github.com/rudolfochrist/interleave, is a very convenient tool for writing notes in associated
>     with pdf. It uses org-mode for this purpose.
>    
>     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
>    
>     * Notes for CS103
>       :PROPERTIES:
>       :INTERLEAVE_PDF: cs103.pdf
>       :END:
>
>     I would like to have the possibility of using any headline level for
>     this purpose but my org-fu is weak.
>    
>     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)
>       "Return the INTERLEAVE_PDF property of the current headline in BUFFER."
>     (with-current-buffer buffer
>       (save-excursion
>         (let ((headline (org-element-at-point)))
>           (when (and (equal (org-element-type headline) 'headline)
>                      (org-entry-get nil interleave--pdf-prop))
>             (setq interleave-multi-pdf-notes-file t)
>             (org-entry-get nil interleave--pdf-prop))))))
>    
>     #+END_SRC
>
>     Can anyone see a way around it ?
>    
>     Best regards,
>    
>     Jeremie

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

* Re: How to obtain the headline level from org-element-at-point
  2017-04-08 15:05   ` Jeremie Juste
@ 2017-04-08 15:31     ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2017-04-08 15:31 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: emacs-orgmode

There is nothing in that function that limits it to level 2 headings.
The only way you would not get the property is if you are on the level
one heading. It will not look down into the subheading for the property.


Jeremie Juste writes:

> 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
>      ** 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
>> 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 <jeremiejuste@gmail.com> wrote:
>>
>>     Hello,
>>
>>     Interleave-mode https://github.com/rudolfochrist/interleave, is a very convenient tool for writing notes in associated
>>     with pdf. It uses org-mode for this purpose.
>>
>>     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
>>
>>     * Notes for CS103
>>      :PROPERTIES:
>>      :INTERLEAVE_PDF: cs103.pdf
>>      :END:
>>
>>     I would like to have the possibility of using any headline level for
>>     this purpose but my org-fu is weak.
>>
>>     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)
>>      "Return the INTERLEAVE_PDF property of the current headline in BUFFER."
>>     (with-current-buffer buffer
>>      (save-excursion
>>       (let ((headline (org-element-at-point)))
>>        (when (and (equal (org-element-type headline) 'headline)
>>             (org-entry-get nil interleave--pdf-prop))
>>         (setq interleave-multi-pdf-notes-file t)
>>         (org-entry-get nil interleave--pdf-prop))))))
>>
>>     #+END_SRC
>>
>>     Can anyone see a way around it ?
>>
>>     Best regards,
>>
>>     Jeremie


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2017-04-08 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-08 14:17 How to obtain the headline level from org-element-at-point Jeremie Juste
2017-04-08 14:31 ` John Kitchin
2017-04-08 15:05   ` Jeremie Juste
2017-04-08 15:31     ` John Kitchin

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