Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-28 Thread Nicolas Goaziou
Hello,

Martin Carlé  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



Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-28 Thread Martin Carlé

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

> Hello,
>
> Martin Carlé  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

  > |   

  > | ))) 

Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-27 Thread Nicolas Goaziou
Hello,

Martin Carlé  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



Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-27 Thread Martin Carlé
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é  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


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Martin Carlé
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é  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


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Thomas S . Dye
Aloha Nicolas,

Nicolas Goaziou writes:

> Hello,
>
> Thomas S. Dye  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



Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Nicolas Goaziou
Hello,

Thomas S. Dye  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 Goaziou0x80A93738



Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Thomas S . Dye

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



Re: [O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Nicolas Goaziou
Hello,

Martin Carlé  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



[O] [bug] inserting footnotes via org-footnote-action command

2016-02-26 Thread Martin Carlé
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


smime.p7s
Description: S/MIME cryptographic signature