Re: [FR] Enhancing footnote managment (via indirect buffer)?

2023-07-03 Thread Andrea Lazzarini

> Il giorno 2 lug 2023, alle ore 12:56, Ihor Radchenko  ha 
> scritto:
> 
> Hello,
> 
> It has been over one month since the last message in this thread.
> Are you still interested to work on this feature? Do you need any help?


Hi,

I was busy with work and had less time to focus on this, sorry!
Well, sorry for the noob question but how do you suggest I fork the org.el file 
to start tinkering with it?
I would pass through the Org repository on Savannah, as specified here: 
https://orgmode.org/worg/org-contribute.html 
.
What do you suggest for testing the changes? Should I then send a diff?

I guess I can manage to have the code I already produced working in org.el. In 
what section of it should the eldoc package be required?

Thank you so much.

Fwd: [FR] Enhancing footnote managment (via indirect buffer)?

2023-05-26 Thread Andrea Lazzarini
Il giorno 24 mag 2023, alle ore 11:03, Ihor Radchenko  ha 
scritto:
> 
> Payas Relekar  writes:
> 
>> I've been playing with org-footnote-assistance, and this is again just
>> another opinion, but I'm also preferring the indirect buffer. It just
>> puts things in better perspective.
> 
> I'd prefer to integrate things with `org-edit-special', if possible.
> Possibly extending `org-edit-special' functionality.
> 
> The pros for `org-edit-special' are that we can escape certain edge
> cases. In particular, there is a known edge case when footnote
> definition contains an src block with 2+ blank lines. The blank lines
> are treated as the end of the footnote definition and src block is not
> recognized. Also, `org-edit-footnote-reference' takes care about
> removing common indentation.
> 

I've tried to use org-edit-special with a src block with 2+ blank lines and the 
second #+end_src is not seen as part of the footnote.
Is this the edge problem you were addressing? I get the same result with the 
indirect buffer.

I'll try to implement at least footnote previewing functionalities with eldoc!

> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 





Re: [FR] Enhancing footnote managment (via indirect buffer)?

2023-05-23 Thread Andrea Lazzarini



> Il giorno 22 mag 2023, alle ore 17:30, Ihor Radchenko  
> ha scritto:
> 
> Andrea Lazzarini  writes:
> 
>> Eldoc (or tooltips) could be great for previewing: I'm going to give them a 
>> try
>> and to see how they might be integrated in an academic writing workflow.
>> I wander if they would maintain buffer-specific highlighting though...
> 
> AFAIK, Eldoc expects a function that will return the string to be
> displayed. You can use `font-lock-ensure' to fontify the footnote
> definition you need to display. Then, the copied string will hold the
> fontification as it would be in Org mode buffer.
> 

Ok, very good. This is my first attempt at it and, apparently, it works.

(setq eldoc-echo-area-use-multiline-p nil)

(defun org-footnote-eldoc-function (callback  _ignored)
  "Return the definition of the footnote at point for Eldoc."
  (when (org-footnote-at-reference-p)
(let* ((footnote-label (car (org-footnote-at-reference-p)))
   (footnote-definition (org-footnote-get-definition footnote-label))
   (start-def (nth 1 footnote-definition))
   (end-def (nth 2 footnote-definition)))
  (when footnote-definition
(font-lock-ensure start-def end-def)
(format "%s"  (buffer-substring start-def end-def))

(defun org-footnote-enable-eldoc ()
  "Enable Eldoc support for Org Mode footnotes."
  (add-hook 'eldoc-documentation-functions #'org-footnote-eldoc-function nil t))

(add-hook 'org-mode-hook #'org-footnote-enable-eldoc)

I now wonder if there is a way to prevent changing 
eldoc-echo-area-use-multiline-p
to nil globally to prevent footnotes from appearing there and not only in the
eldoc-doc-buffer.

Provided this might be considered useful, where could such a feature be
implemented? I checked org-eldoc.el, but it looks like it aims at
providing programming documentation inside org-mode rather than
implementing specific org-oriented features.


>>> "Eeasier Footnote Deletion": How is it different from `org-footnote-delete'?
>>> 

>> That was nothing more than a simple wrapper for org-footnote-delete, which
>> is not an interactive function: btw, I am curious to know if there is a 
>> reason for
>> that. Why should users re-implement org-footnote-delete with wrappers if 
>> they want to use it interactively?
> 
> I see nothing in git history and mailing list.
> I think that it makes sense to convert org-footnote-delete into
> interactive function.

That would be great.

I've fiddled with org-edit-special and I see it has a major flaw, at least in 
my opinion.
It inserts all changes without keeping track of the undos, as opposed to the 
indirect
buffer solution, which also had the advantage of doing everything from a single 
buffer:
it operates as some sort of 'window' on a part of the file, rather than feeling 
as some
sort of out-of-the-normal operation. Aren't there other possibile use cases for 
indirect
buffers in org mode? Why are they considered inferior to other solutions? I ask 
just
for my understanding.

(A combination of eldoc + org-edit-special might be rather affecting on the
seamlessness of the workflow, but this is of course my simple personal opinion).


> Il giorno 22 mag 2023, alle ore 13:45, Ihor Radchenko  
> ha scritto:
> 
> This sounds like something we can extend `org-forward-element' and
> `org-backward-element' with - it may not only jump to the next element,
> but also jump to the next element of the same type. Jumping to next/previous
> footnote might will useful as a separate command as well though, as a
> complement to the existing `org-next-item', `org-next-link',
> `org-next-block', etc.


Functions that make navigation between similar elements easier would simply be 
great.







[FR] Enhance footnote editing?

2023-05-22 Thread Andrea Lazzarini
I have recently developed a very simple package, org-footnote-assistant (link:
https://github.com/lazzalazza/org-footnote-assistant), which aims to enhance the
functionality and user experience of footnotes within Org Mode. It mainly uses
an indirect buffer to try to solve the problem of limited inline viewing of
footnotes, making it easier to review and modify content without disrupting your
workflow. I recently shared this package via Reddit, and it received, I think, a
fairly positive feedback from the community.

The org-footnote-assistant package introduces several features that improve the
management and editing of footnotes in Org Mode. The features include commands
for easy navigation between footnote references. Users can quickly jump to the
next reference or return to the previous one, ensuring a smooth editing
workflow.

The positive feedback and interest received on Reddit (and a comment by
alphapapa) have encouraged me to explore the possibility of integrating some of
these features upstream to prevent bitrot, ensure wider accessibility, and
leverage the collaborative power of the Org Mode community for their continued
maintenance and development.

I kindly request your feedback, evaluation, and suggestions regarding the
org-footnote-assistant package. I don’t know if some of these features might be
useful upstream, but I believe that your insights and expertise will be
invaluable in refining and optimizing these features for the benefit of all Org
Mode users.

Thank you,

Andrea Lazzarini
[GitHub: lazzalazza]
[Link to org-footnote-assistant: 
https://github.com/lazzalazza/org-footnote-assistant]



Re: [FR] Enhancing footnote managment (via indirect buffer)?

2023-05-22 Thread Andrea Lazzarini



> Il giorno 22 mag 2023, alle ore 13:45, Ihor Radchenko  
> ha scritto:
> 
> Andrea Lazzarini  writes:
> 
>> I am writing to you because I have recently published a simple package called
>> org-footnote-assistant 
>> [https://github.com/lazzalazza/org-footnote-assistant],
>> which aims at improving the overall functionality and user experience of 
>> footnotes
>> within Org Mode.
> 
> Thanks for your interest to contribute to Org mode!

Thank you for your kind reply, for the consideration and the great tips!

> 
>> The current management of footnotes has certain limitations that can 
>> sometimes
>> hinder the overall user experience. One major limitation is the limited 
>> inline
>> viewing of footnotes, which makes it challenging to review and modify 
>> footnote
>> content precisely and without disrupting the workflow.
>> 
>> Org-footnote-assistant addresses the limitations of inline viewing of 
>> footnotes
>> by using an indirect buffer.
> 
> I am not sure if indirect buffer is the right approach for _previews_.
> It is more common in Emacs to either use eldoc or tooltips.
> You may use
> https://www.masteringemacs.org/article/seamlessly-merge-multiple-documentation-sources-eldoc
> as reference about eldoc.
> 

Eldoc (or tooltips) could be great for previewing: I'm going to give them a try
and to see how they might be integrated in an academic writing workflow.
I wander if they would maintain buffer-specific highlighting though...

>> The package also provides commands for easy
>> navigation between footnote references, enabling quick jumps to the next or
>> previous reference.
> 
> This sounds like something we can extend `org-forward-element' and
> `org-backward-element' with - it may not only jump to the next element,
> but also jump to the next element of the same type. Jumping to next/previous
> footnote might will useful as a separate command as well though, as a
> complement to the existing `org-next-item', `org-next-link',
> `org-next-block', etc.
> 

Yes, this actually sounds great, and would make it really easier to implement
focused jumping.

> "Footnote Editing Window" sounds like a duplicate of the existing C-c '
> functionality (`org-edit-special').
> 

Yep! It is, and that's also very good to know: I am sorry but this totally flew
over my head in these years of using org... 

> "Customized Footnote Definition Jumping" does not sound too different
> from editing window. May you elaborate why it is useful?
> 
> I am not sure if I understand what "Enhanced Footnote Reference
> Searching" does from its description.
> 
> "Eeasier Footnote Deletion": How is it different from `org-footnote-delete'?
> 

That was nothing more than a simple wrapper for org-footnote-delete, which
is not an interactive function: btw, I am curious to know if there is a reason 
for
that. Why should users re-implement org-footnote-delete with wrappers if 
they want to use it interactively?

Many thanks!

Andrea Lazzarini

> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>




[FR] Enhancing footnote managment (via indirect buffer)?

2023-05-22 Thread Andrea Lazzarini
I am writing to you because I have recently published a simple package called
org-footnote-assistant [https://github.com/lazzalazza/org-footnote-assistant],
which aims at improving the overall functionality and user experience of 
footnotes
within Org Mode.

The current management of footnotes has certain limitations that can sometimes
hinder the overall user experience. One major limitation is the limited inline
viewing of footnotes, which makes it challenging to review and modify footnote
content precisely and without disrupting the workflow.

Org-footnote-assistant addresses the limitations of inline viewing of footnotes
by using an indirect buffer.The package also provides commands for easy
navigation between footnote references, enabling quick jumps to the next or
previous reference.

On Reddit I have been encouraged to seek your feedback and explore the
possibility of integrating some of these features upstream to prevent bitrot and
ensure wider accessibility, and I am of course open to any suggestion or input.

Best,

Andrea Lazzarini
GitHub: lazzalazza




Re: [BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]

2023-03-05 Thread Andrea Lazzarini
If some languages require it and some not, as you correctly say, couldn't the 
behaviour be customizable? 

> Il giorno 5 mar 2023, alle ore 13:42, Ihor Radchenko  ha 
> scritto:
> 
> 
> Andrea Lazzarini  writes:
>> Consider the fact that I had to put an extra space before the footnote 
>> exactly to have a space (not an extra one) in the result.
>> 
>> As you say, couldn't it be replaced with:
>> 
>>> maybe with number of spaces equal to :post-blank ?
> 
> Sure, but footnotes are expected to have space before in some languages:
> 
> Sentence. [footnote] Another sentence.
> 
> Keeping the space after will leave us with _two_ spaces:
> 
> Sentence.  Another sentence.
> 
> Not ideal when exporting to, say, ASCII.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>




Re: [BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]

2023-03-05 Thread Andrea Lazzarini
Consider the fact that I had to put an extra space before the footnote exactly 
to have a space (not an extra one) in the result.

As you say, couldn't it be replaced with:

> maybe with number of spaces equal to :post-blank ?



> Il giorno 5 mar 2023, alle ore 13:06, Ihor Radchenko  ha 
> scritto:
> 
> Max Nikulin  writes:
> 
>> In my opinion, the filter removing footnotes should transfer afterspaces 
>> to preceding objects.
> 
> I am not sure.
> 
> Consider text like "Pellentesque dapibus suscipit ligula. [fn:1] Donec 
> posuere augue in quam."
> with space before the footnote. If we replace the footnote with space,
> two spaces will be exported. I am not sure if it is expected.
> 
> Also, should we replace footnote with a single space or with the number
> of spaces after?
> 
> Further, this bug is actually not just about footnotes. The footnotes
> are removed in `org-export--prune-tree':
> 
>(if (org-export--skip-p data info selected excluded)
> (if (memq type '(table-cell table-row)) (push data ignore)
>   (org-element-extract-element data))
> 
> The extracted objects can be latex-fragment, statistics-cookie,
> timestamp, and footnote.
> 
> Will it be safe to replace all the above with space? Or maybe with
> number of spaces equal to :post-blank? Something else?
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 




Re: [BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]

2023-03-04 Thread Andrea Lazzarini
I totally agree with Max Nikulin: wouldn't that be an improvement? That would 
make things a lot easier for those instances in which you want to put the 
footnotes back in.

> Il giorno 3 mar 2023, alle ore 17:47, Max Nikulin  ha 
> scritto:
> 
> On 03/03/2023 22:47, Ihor Radchenko wrote:
>> Max Nikulin writes:
>>> Self-containing example:
>>> 
>>>  8< 
>>> #+options: f:nil
>>> 
>>> Pellentesque dapibus suscipit ligula.[fn::1 ftnt]  Donec posuere augue
>>> in quam.
>>>  >8 
>> This is because spaces after Org syntax objects are considered a part of
>> those syntax objects.  So, excluding footnote automatically means
>> excluding spaces after.
> 
> In my opinion, the filter removing footnotes should transfer afterspaces to 
> preceding objects.
> 




[BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]

2023-03-03 Thread Andrea Lazzarini


After setting 'org-export-with-footnotes' to 'nil', 
the space following the footnote is removed when exporting (I’ve tested
this with pandoc [docx and html]).

So, given this example:

«Pellentesque dapibus suscipit ligula.[fn:1]  Donec posuere augue in quam.»

The resulting text is:

«Pellentesque dapibus suscipit ligula.Donec posuere augue in quam.»

The only way in which I can get a space in the correct place  is by putting an 
extra one
before the footnote.


Emacs  : GNU Emacs 28.0.91 (build 1, aarch64-apple-darwin21.2.0, NS 
appkit-2113.20 Version 12.1 (Build 21C52))
 of 2022-02-06
Package: Org mode version 9.6.1 ( @ 
/Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)




Problems with bibliography while exporting org files

2021-11-08 Thread Andrea Lazzarini
Hi,

I’m a Spacemacs user, and I’ve just upgraded to org mode 9.5.
Coming from 9.4.6, I’m currently trying to figure out how to adapt to the 
changes in the export mechanism.

When I then try to export an org file via org-export and pandoc, I get the 
following message:

Wrong type argument: stringp, 
("~/Dropbox/Standard/Bibliografia/bibliografia_generale.bib")

I am setting my bibliography thus:

(setq org-cite-global-bibliography
'("~/Dropbox/Standard/Bibliografia/bibliografia_generale.bib"))

If I specify a "#+bibliography:” locally in the org file, the same problem 
reoccurs, now stating:

Wrong type argument: stringp, ("local.bib" 
"~/Dropbox/Standard/Bibliografia/bibliografia_generale.bib")

Is there something I must do to be able to export correctly?

Thanks,

Andrea


Emacs  : GNU Emacs 28.0.60 (build 1, x86_64-apple-darwin20.6.0, NS 
appkit-2022.60 Version 11.6 (Build 20G165))
 of 2021-11-02
Package: Org mode version 9.5 (release_9.5-59-g52e6f1 @ 
/usr/local/Cellar/emacs-plus@28/28.0.50/share/emacs/28.0.60/lisp/org/)

current state:
==
(setq
 org-noter--doc-goto-location-hook '(org-noter-pdftools--doc-goto-location)
 org-noter--check-location-property-hook '(org-noter-pdftools--check-link)
 org-link-elisp-confirm-function 'yes-or-no-p
 org-roam-db-gc-threshold 402653184
 org-ref-cite-onclick-function #[257 "\300 \207" [org-ref-citation-hydra/body] 
2 "\n\n(fn _)"]
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-pdftools-get-desc-function 'org-pdftools-get-desc-default
 org-ref-insert-cite-function 'org-ref-insert-cite-link
 org-download-file-format-function 'org-download-file-format-default
 org-log-done 'time
 org-fontify-done-headline nil
 org-roam-dailies-capture-templates '(("d" "default" plain "%?" :target 
(file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n#+startup: content")))
 org-log-into-drawer t
 org-babel-after-execute-hook '(spacemacs/ob-fix-inline-images)
 org-agenda-files '("~/Dropbox/Agenda/todo.org" 
"~/Dropbox/Agenda/todo.org_archive" "~/Dropbox/Corsi/corsi_conclusi.org" 
"/Users/test/Dropbox/org-roam/20210709174709-erc.org"
"/Users/test/Dropbox/org-roam/20211018120015-disfor.org" 
"/Users/test/Dropbox/org-roam/20211104164945-esami.org"

"/Users/test/Dropbox/org-roam/20211009124857-racconti_de_roberto.org" 
"/Users/test/Dropbox/org-roam/20211006180957-curiosity_driven.org"

"/Users/test/Dropbox/org-roam/20211029144338-de_roberto.org")
 org-capture-templates '(("d" "Deadline" entry (file+headline 
"~/Dropbox/Agenda/todo.org" "Tasks") "* TODO %?\n  DEADLINE: %T\n\n")
 ("t" "Task" entry (file+headline 
"~/Dropbox/Agenda/todo.org" "Tasks") "* TODO %?\n  SCHEDULED: %T\n\n")
 ("i" "Idea" entry (file+headline 
"~/Dropbox/Agenda/inbox.org" "Idee") "* %?"))
 org-export-before-parsing-hook '(org-attach-expand-links org-reledmac-export)
 org-default-notes-file "~/Dropbox/Agenda/todo.org"
 org-export-async-init-file 
"/Users/test/.emacs.d/layers/+emacs/org/local/org-async-init.el"
 org-roam-find-file-hook '(org-roam-buffer--setup-redisplay-h 
org-roam--register-completion-functions-h org-roam--replace-roam-links-on-save-h
   org-roam-open-id-with-org-roam-db-h 
org-roam-db-autosync--setup-update-on-save-h)
 org-ref-bibtex-assoc-pdf-with-entry-move-function 'rename-file
 org-publish-timestamp-directory "~/.emacs.d/.cache/.org-timestamps/"
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-file-apps '(("\\.docx\\'" . default) (auto-mode . emacs))
 org-noter-pdftools-markup-pointer-function 
'pdf-annot-add-highlight-markup-annotation
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS 
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-noter--note-after-tipping-point-hook 
'(org-noter-pdftools--note-after-tipping-point)
 org-modules '(org-habit ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus 
ol-info ol-irc ol-mhe ol-rmail ol-eww)
 org-ref-notes-function 'orb-org-ref-edit-note
 org-image-actual-width nil
 org-mode-hook '(er/add-org-mode-expansions org-ref-org-menu #[0 
"\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all 
append local] 5]
 #[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-babel-show-result-all append local] 5] 
org-babel-result-hide-spec
 org-babel-hide-all-hashes #[0 "\301\211\207" 
[imenu-create-index-function org-imenu-get-tree] 2] flyspell-mode 
spacemacs/org-setup-evil-surround
 spacemacs/load-yasnippet toc-org-enable org-superstar-mode 
(lambda nil (require 'org-ref)) org-download-enable 
dotspacemacs//prettify-spacemacs-docs