emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] inserting footnotes via org-footnote-action command
@ 2016-02-26 17:35 Martin Carlé
  2016-02-26 21:53 ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Carlé @ 2016-02-26 17:35 UTC (permalink / raw)
  To: emacs-org list

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

Hello,

the outline heading containing footnote definitions (as specified by
org-footnote-section) does not accept tags.

E.g. if you add a tag to this headline and then try to insert a footnote
via the org-footnote-action command, always a new headline without the
tag is created and the former footnote order gets spoiled.

I would be nice, if this could be fixed, such that org-footnote-section
can have tags (or even to-do keywords, drawers, etc.).

Thank you,
mc

-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-26 17:35 [bug] inserting footnotes via org-footnote-action command Martin Carlé
@ 2016-02-26 21:53 ` Nicolas Goaziou
  2016-02-26 22:42   ` Thomas S. Dye
  2016-02-27  0:37   ` Martin Carlé
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2016-02-26 21:53 UTC (permalink / raw)
  To: Martin Carlé; +Cc: emacs-org list

Hello,

Martin Carlé <mc@aiguphonie.com> writes:

> the outline heading containing footnote definitions (as specified by
> org-footnote-section) does not accept tags.
>
> E.g. if you add a tag to this headline and then try to insert a footnote
> via the org-footnote-action command, always a new headline without the
> tag is created and the former footnote order gets spoiled.
>
> I would be nice, if this could be fixed, such that org-footnote-section
> can have tags (or even to-do keywords, drawers, etc.).

You shouldn't put anything else than footnotes in the footnotes section.
It can be erased without notice, e.g., when sorting footnotes, and all
information inside, besides footnotes, will be lost.

See it as a reserved (optional) headline. Maybe the manual should be
more explicit about it.


Regards,

-- 
Nicolas Goaziou

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-26 21:53 ` Nicolas Goaziou
@ 2016-02-26 22:42   ` Thomas S. Dye
  2016-02-26 23:57     ` Nicolas Goaziou
  2016-02-27  0:37   ` Martin Carlé
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2016-02-26 22:42 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list, Martin Carlé


Nicolas Goaziou writes:
>
> You shouldn't put anything else than footnotes in the footnotes section.
> It can be erased without notice, e.g., when sorting footnotes, and all
> information inside, besides footnotes, will be lost.

Thanks for pointing this out.  Is it possible to disable all the features, like
sorting, that erase without notice?  I've got org-footnote-auto-adjust
set to nil, which looks like a step in the right direction, but I'm
wondering if there is more I can do.

My Tufte Org Mode files have LaTeX attributes associated with footnote
definitions and I don't want to lose them, if possible.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-26 22:42   ` Thomas S. Dye
@ 2016-02-26 23:57     ` Nicolas Goaziou
  2016-02-27  0:02       ` Thomas S. Dye
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2016-02-26 23:57 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-org list, Martin Carlé

Hello,

Thomas S. Dye <tsd@tsdye.com> writes:

> Thanks for pointing this out.  Is it possible to disable all the features, like
> sorting, that erase without notice?  I've got org-footnote-auto-adjust
> set to nil, which looks like a step in the right direction, but I'm
> wondering if there is more I can do.
>
> My Tufte Org Mode files have LaTeX attributes associated with footnote
> definitions and I don't want to lose them, if possible.

The footnote themselves, along with any attributes associated to them,
are never erased.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-26 23:57     ` Nicolas Goaziou
@ 2016-02-27  0:02       ` Thomas S. Dye
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas S. Dye @ 2016-02-27  0:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list, Martin Carlé

Aloha Nicolas,

Nicolas Goaziou writes:

> Hello,
>
> Thomas S. Dye <tsd@tsdye.com> writes:
>
>> Thanks for pointing this out.  Is it possible to disable all the features, like
>> sorting, that erase without notice?  I've got org-footnote-auto-adjust
>> set to nil, which looks like a step in the right direction, but I'm
>> wondering if there is more I can do.
>>
>> My Tufte Org Mode files have LaTeX attributes associated with footnote
>> definitions and I don't want to lose them, if possible.
>
> The footnote themselves, along with any attributes associated to them,
> are never erased.

Good news.  Thanks for the clarification.

All the best
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-26 21:53 ` Nicolas Goaziou
  2016-02-26 22:42   ` Thomas S. Dye
@ 2016-02-27  0:37   ` Martin Carlé
  2016-02-27  8:16     ` Nicolas Goaziou
  1 sibling, 1 reply; 11+ messages in thread
From: Martin Carlé @ 2016-02-27  0:37 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list

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

Thank you for the quick answer!

All right, deletion and recreation of the section is fine with me, as
long as the tags would be recreated as well.

Keeping the tags is actually crucial to my practice, since I run some
filters during export based on tags.

Couldn't the algorithm be adopted to check for tags assigned to the
org-footnote-section and then re-create them as well?

Including this feature would be tremendously helpful and shouldn't do
harm to anybody else.

Best,
mc

On 2016-02-26 Fri 23:53, Nicolas Goaziou wrote:

> Hello,
>
> Martin Carlé <mc@aiguphonie.com> writes:
>
>> the outline heading containing footnote definitions (as specified by
>> org-footnote-section) does not accept tags.
>>
>> E.g. if you add a tag to this headline and then try to insert a footnote
>> via the org-footnote-action command, always a new headline without the
>> tag is created and the former footnote order gets spoiled.
>>
>> I would be nice, if this could be fixed, such that org-footnote-section
>> can have tags (or even to-do keywords, drawers, etc.).
>
> You shouldn't put anything else than footnotes in the footnotes section.
> It can be erased without notice, e.g., when sorting footnotes, and all
> information inside, besides footnotes, will be lost.
>
> See it as a reserved (optional) headline. Maybe the manual should be
> more explicit about it.
>
>
> Regards,


-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-27  0:37   ` Martin Carlé
@ 2016-02-27  8:16     ` Nicolas Goaziou
  2016-02-27 11:12       ` Martin Carlé
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2016-02-27  8:16 UTC (permalink / raw)
  To: Martin Carlé; +Cc: emacs-org list

Hello,

Martin Carlé <mc@aiguphonie.com> writes:

> Keeping the tags is actually crucial to my practice, since I run some
> filters during export based on tags.
>
> Couldn't the algorithm be adopted to check for tags assigned to the
> org-footnote-section and then re-create them as well?

Footnote section is special, so, in a sense, is a tag on its own.
Besides, export process completely ignores this section. So, I'm not
sure about what you want to achieve with tagging it. Would you want to
elaborate a bit?


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-27  8:16     ` Nicolas Goaziou
@ 2016-02-27 11:12       ` Martin Carlé
  2016-02-28  0:23         ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Carlé @ 2016-02-27 11:12 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list

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

Thanks for inviting me to elaborate.

Well, I wrapped the exporter mechanism into some advice functions that
allow for many different exports from a single file in such a manner that
multiple exports are not restricted to subtrees.

This extended export mechanism collects sections as marked by tags.
This is why, I need to tag the org-footnote-section as well.

Best regards,
mc


On 2016-02-27 Sat 10:16, Nicolas Goaziou wrote:

> Hello,
>
> Martin Carlé <mc@aiguphonie.com> writes:
>
>> Keeping the tags is actually crucial to my practice, since I run some
>> filters during export based on tags.
>>
>> Couldn't the algorithm be adopted to check for tags assigned to the
>> org-footnote-section and then re-create them as well?
>
> Footnote section is special, so, in a sense, is a tag on its own.
> Besides, export process completely ignores this section. So, I'm not
> sure about what you want to achieve with tagging it. Would you want to
> elaborate a bit?
>
>
> Regards,


-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-27 11:12       ` Martin Carlé
@ 2016-02-28  0:23         ` Nicolas Goaziou
  2016-02-28 11:13           ` Martin Carlé
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2016-02-28  0:23 UTC (permalink / raw)
  To: Martin Carlé; +Cc: emacs-org list

Hello,

Martin Carlé <mc@aiguphonie.com> writes:

> Well, I wrapped the exporter mechanism into some advice functions that
> allow for many different exports from a single file in such a manner that
> multiple exports are not restricted to subtrees.

Not sure to understand this.

> This extended export mechanism collects sections as marked by tags.
> This is why, I need to tag the org-footnote-section as well.

Why don't you also collect systematically the footnote section?

Regards,

-- 
Nicolas Goaziou

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-28  0:23         ` Nicolas Goaziou
@ 2016-02-28 11:13           ` Martin Carlé
  2016-02-28 15:12             ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Carlé @ 2016-02-28 11:13 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list

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


On 2016-02-28 Sun 02:23, Nicolas Goaziou wrote:

> Hello,
>
> Martin Carlé <mc@aiguphonie.com> writes:
>
>> Well, I wrapped the exporter mechanism into some advice functions that
>> allow for many different exports from a single file in such a manner that
>> multiple exports are not restricted to subtrees.
>
> Not sure to understand this.

Never mind, I shall explain and release all the hack, if there is more time.

>
>> This extended export mechanism collects sections as marked by tags.
>> This is why, I need to tag the org-footnote-section as well.
>
> Why don't you also collect systematically the footnote section?

Because, tags are a general and convenient way of collecting sections
and I'like to avoid special where ever possible.


All in all, below are the tiny changes I was looking for,
marked in comments as 'hack'.


All best,
mc


  > ,----
  > |                                                                                               
  > | (defun org-footnote--clear-footnote-section ()                                                
  > |   "Remove all footnote sections in buffer and create a new one.                               
  > |                     New section is created at the end of the buffer, before any file          
  > |                     local variable definition.  Leave point within the new section."          
  > |   (when org-footnote-section                                                                  
  > |     (goto-char (point-min))                                                                   
  > |     (let ((regexp                                                                             
  > |            (format org-complex-heading-regexp-format ;; "^\\*+ +%s[ \t]*$"                    
  > |                    (regexp-quote org-footnote-section)))                                      
  > |           tags) ;;; hack                                                                      
  > |       (while (re-search-forward regexp nil t)                                                 
  > |                                                                                               
  > |         ;; ;;; hack                                                                           
  > |         (save-match-data                                                                      
  > |           (save-excursion                                                                     
  > |             (beginning-of-line 1)                                                             
  > |             (looking-at org-todo-line-tags-regexp)                                            
  > |             (when (match-beginning 4)                                                         
  > |               (setq tags (concat " " (buffer-substring (match-beginning 4) (match-end 4)))))))
  > |                                                                                               
  > |         (delete-region                                                                        
  > |          (match-beginning 0)                                                                  
  > |          (progn (org-end-of-subtree t t)                                                      
  > |                 (if (not (eobp)) (point)                                                      
  > |                   (org-footnote--goto-local-insertion-point)                                  
  > |                   (skip-chars-forward " \t\n")                                                
  > |                   (if (eobp) (point) (line-beginning-position))))))                           
  > |       (goto-char (point-max))                                                                 
  > |       (org-footnote--goto-local-insertion-point)                                              
  > |       (when (and (cdr (assq 'heading org-blank-before-new-entry))                             
  > |                  (zerop (save-excursion (org-back-over-empty-lines))))                        
  > |         (insert "\n"))                                                                        
  > |       ;; (insert "* " org-footnote-section "\n")                                              
  > |       (insert "* " org-footnote-section (or tags "") "\n") ;;; hack — the simple way          
  > |     (when tags                                                                                
  > |       (save-excursion                                                                         
  > |         (org-back-to-heading t)                                                               
  > |         (org-set-tags nil 'align))) ;;; hack — the aligned way                                
  > |                                                                                               
  > |     )))                                                                                       
  > |                                                                                               
  > `----

  > ,----
  > |                                                                                                  
  > | (defun org-footnote-create-definition (label)                                                    
  > |   "Start the definition of a footnote with label LABEL.                                          
  > |   Return buffer position at the beginning of the definition.  This                               
  > |   function doesn't move point."                                                                  
  > |   (let ((label (org-footnote-normalize-label label))                                             
  > |         electric-indent-mode)     ; Prevent wrong indentation.                                   
  > |     (org-with-wide-buffer                                                                        
  > |      (cond                                                                                       
  > |       ((not org-footnote-section) (org-footnote--goto-local-insertion-point))                    
  > |       ((save-excursion                                                                           
  > |          (goto-char (point-min))                                                                 
  > |          (re-search-forward                                                                      
  > |           ;; (concat "^\\*+[ \t]+" (regexp-quote org-footnote-section) "[ \t]*$")                
  > |           (format org-complex-heading-regexp-format (regexp-quote org-footnote-section)) ;;; hack
  > |           nil t))                                                                                
  > |        (goto-char (match-end 0))                                                                 
  > |        (forward-line)                                                                            
  > |        (unless (bolp) (insert "\n")))                                                            
  > |       (t (org-footnote--clear-footnote-section)))                                                
  > |      (when (zerop (org-back-over-empty-lines)) (insert "\n"))                                    
  > |      (insert "[fn:" label "] \n")                                                                
  > |      (line-beginning-position 0))))                                                              
  > `----


-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

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

* Re: [bug] inserting footnotes via org-footnote-action command
  2016-02-28 11:13           ` Martin Carlé
@ 2016-02-28 15:12             ` Nicolas Goaziou
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2016-02-28 15:12 UTC (permalink / raw)
  To: Martin Carlé; +Cc: emacs-org list

Hello,

Martin Carlé <mc@aiguphonie.com> writes:

> Never mind, I shall explain and release all the hack, if there is more
> time.

OK.

> Because, tags are a general and convenient way of collecting sections
> and I'like to avoid special where ever possible.

Well, `org-footnote-section' is special, but it's really easy to know if
you're at a footnote section. 

Besides, you may as well set it to nil, so as to not bother at all.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-02-28 15:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 17:35 [bug] inserting footnotes via org-footnote-action command Martin Carlé
2016-02-26 21:53 ` Nicolas Goaziou
2016-02-26 22:42   ` Thomas S. Dye
2016-02-26 23:57     ` Nicolas Goaziou
2016-02-27  0:02       ` Thomas S. Dye
2016-02-27  0:37   ` Martin Carlé
2016-02-27  8:16     ` Nicolas Goaziou
2016-02-27 11:12       ` Martin Carlé
2016-02-28  0:23         ` Nicolas Goaziou
2016-02-28 11:13           ` Martin Carlé
2016-02-28 15:12             ` Nicolas Goaziou

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