Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point)

2024-05-25 Thread Jim Porter

On 5/25/2024 7:09 AM, Ihor Radchenko wrote:

Ok. Now, may you also add NEWS entry?


See attached. I made my best guess on what subsection of NEWS to use 
("New functions and changes in function arguments"), but maybe that's 
not quite right. It didn't seem to fit in any of the other sections very 
well either, though...From 17b2bae16a5e07f09599b521563536037daa0f8c Mon Sep 17 00:00:00 2001
From: Jim Porter 
Date: Mon, 6 Nov 2023 11:39:09 -0800
Subject: [PATCH] Add support for 'thing-at-point' to get URL at point

* lisp/org.el (thingatpt): Require.
(org--link-at-point, org--bounds-of-link-at-point): New functions...
(org-mode): ... add to 'thing-at-point-provider-alist' and friends.

* testing/lisp/test-org.el (test-org/thing-at-point/url): New test.

* etc/ORG-NEWS: Announce this change.
---
 etc/ORG-NEWS |  5 +
 lisp/org.el  | 25 +
 testing/lisp/test-org.el | 13 +
 3 files changed, 43 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e2bbe3e0e..d5d891ba0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1474,6 +1474,11 @@ optional argument =NEW-HEADING-CONTAINER= specifies 
where in the
 buffer it will be added.  If not specified, new headings are created
 at level 1 at the end of the accessible part of the buffer, as before.
 
+*** Org links now support ~thing-at-point~
+
+You can now retrieve the destination of a link by calling
+~(thing-at-point 'url)~.
+
 ** Miscellaneous
 *** Add completion for links to man pages
 
diff --git a/lisp/org.el b/lisp/org.el
index ed18565bd..656f628ba 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -81,6 +81,7 @@
 (require 'calendar)
 (require 'find-func)
 (require 'format-spec)
+(require 'thingatpt)
 
 (condition-case nil
 (load (concat (file-name-directory load-file-name)
@@ -5041,6 +5042,19 @@ The following commands are available:
 #'pcomplete-completions-at-point nil t)
   (setq-local buffer-face-mode-face 'org-default)
 
+  ;; `thing-at-point' support
+  (setq-local thing-at-point-provider-alist
+  (cons '(url . org--link-at-point)
+thing-at-point-provider-alist))
+  (when (boundp 'forward-thing-provider-alist)
+(setq-local forward-thing-provider-alist
+(cons '(url . org-next-link)
+  forward-thing-provider-alist)))
+  (when (boundp 'bounds-of-thing-at-point-provider-alist)
+(setq-local bounds-of-thing-at-point-provider-alist
+(cons '(url . org--bounds-of-link-at-point)
+  bounds-of-thing-at-point-provider-alist)))
+
   ;; If empty file that did not turn on Org mode automatically, make
   ;; it to.
   (when (and org-insert-mode-line-in-empty-file
@@ -8753,6 +8767,17 @@ there is one, return it."
   (setq link (nth (1- nth) links)
(cons link end)
 
+(defun org--link-at-point ()
+  "`thing-at-point' provider function."
+  (org-element-property :raw-link (org-element-context)))
+
+(defun org--bounds-of-link-at-point ()
+  "`bounds-of-thing-at-point' provider function."
+  (let ((context (org-element-context)))
+(when (eq (org-element-type context) 'link)
+  (cons (org-element-begin context)
+(org-element-end context)
+
 ;;; File search
 
 (defun org-do-occur (regexp &optional cleanup)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 072d405bd..519b96647 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -3630,6 +3630,19 @@ Foo Bar
 (org-open-at-point))
 nil)
 
+
+;;; Thing at point
+
+(ert-deftest test-org/thing-at-point/url ()
+  "Test that `thing-at-point' returns the URL at point."
+  (org-test-with-temp-text
+  "[[https://www.gnu.org/software/emacs/][GNU Emacs]]"
+(should (string= (thing-at-point 'url)
+ "https://www.gnu.org/software/emacs/";))
+(when (boundp 'bounds-of-thing-at-point-provider-alist)
+  (should (equal (bounds-of-thing-at-point 'url)
+ '(1 . 51))
+
 
 ;;; Node Properties
 
-- 
2.25.1



Manual table of content on specific object type

2024-05-25 Thread Sébastien Gendre
Hello,

I have a question about manual table of content of specific type of
objects with a caption.

On the manual, chapter "13.3 Table of Contents", the keyword "#+TOC:"
can be used to list tables and listings if they have caption. But we can
have caption on more than tables and listings.

Is it possible to have a TOC of figures, or any other object with a
caption ? If yes, where can I found the list of object type and the word
to use ?



Best regards

---
Gendre Sébastien


signature.asc
Description: PGP signature


Managing acronyms in an Org-mode document

2024-05-25 Thread Sébastien Gendre
Hello,


Is there a way to manage acronyms in an Org-mode document ?

For example:

1. I write a list of acronyms and their definition inside a "List of
   acronyms" heading
   
2. In my document, when I simply write the acronyms in my text

3. When I export my Org-mode document, the first time that an acronym is
   written, it appear in full version and all the other times it appear
   in acronym version


Best regards

---
Gendre Sébastien


signature.asc
Description: PGP signature


Re: After years without issues, Orgmode now fails to apply agenda filters to preset templates

2024-05-25 Thread Ihor Radchenko
web...@toryanderson.com (Tory S. Anderson) writes:

> After years without issue where I could choose, for example, to see my
> daily work agenda, the filters are now failing to be applied. This is
> in org 9.6.15, as shipped with my emacs 29.3. I have verified that
> this problem is the same in =emacs -Q= without any other packages:
> when I choose my agenda view, such as "C-a w d" for my daily work
> agenda, I still get an agenda buffer named "Org_Agenda(wd)", but none
> of my preset filters have applied. I skimmed the documentation and I
> haven't seen any changed syntax. Here is my definition from my
> =use-package org= =:custom= section:
>
> #+begin_src lisp
>   (org-agenda-custom-commands
>   '(("w" . "Work")
> ("wd" "Work Day"
>  ((agenda ""
>   ((org-agenda-span 1)
>(org-agenda-start-on-weekday nil)
>(org-agenda-regexp-filter-preset
> '("+ODH\\|AGENDA\\|CONFERENCE" 
> "-TSA\\|PRIESTHOOD")
>  nil)))
> #+end_src

According to the docstring of `org-agenda-regexp-filter-preset',

...The preset filter is a global property of
the entire agenda view.  In a block agenda, it will not work reliably to
define a filter for one of the individual blocks.  You need to set it in
the global options and expect it to be applied to the entire view.

So, you should set this variable as a part of global agenda command
settings, not inside individual block.

Not a bug.
Canceled.

> Why has this stopped applying my filter when it worked for so long? Is
> it a bug, or do I need to change something to make it up-to-date?

I have no idea because you did not tell which Org mode version had your
settings working. I suspect that it could have happened around the time
Org mode switched from dynamic binding to lexical binding, but it is
just a blind guess.

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



After years without issues, Orgmode now fails to apply agenda filters to preset templates

2024-05-25 Thread Tory S. Anderson
Hello,

After years without issue where I could choose, for example, to see my daily 
work agenda, the filters are now failing to be applied. This is in org 9.6.15, 
as shipped with my emacs 29.3. I have verified that this problem is the same in 
=emacs -Q= without any other packages: when I choose my agenda view, such as 
"C-a w d" for my daily work agenda, I still get an agenda buffer named 
"Org_Agenda(wd)", but none of my preset filters have applied. I skimmed the 
documentation and I haven't seen any changed syntax. Here is my definition from 
my =use-package org= =:custom= section:

#+begin_src lisp
  (org-agenda-custom-commands
'(("w" . "Work")
  ("wd" "Work Day"
   ((agenda ""
((org-agenda-span 1)
 (org-agenda-start-on-weekday nil)
 (org-agenda-regexp-filter-preset
  '("+ODH\\|AGENDA\\|CONFERENCE" 
"-TSA\\|PRIESTHOOD")
   nil)))
#+end_src

Why has this stopped applying my filter when it worked for so long? Is it a 
bug, or do I need to change something to make it up-to-date?

(I'm cross-posting this to both reddit and the orgmode mailing list since the 
two audiences might not overlap much)



Re: Error message after upgrading to devel version: const:tag

2024-05-25 Thread Ihor Radchenko
Kepa  writes:

> After updating org-mode to org-9.7pre0.20240524.175607
>
> I get this warning message:
> ■  Warning (emacs): Value 't' does not match type (choice (const :tag nofold: 
> show all nofold) (const :tag fold: overview fold) (const :tag fold: show two 
> levels show2levels) (const :tag fold: show three levels show3levels) (const 
> :tag fold: show four levels show4evels) (const :tag fold: show five levels 
> show5levels) (const :tag content: all headlines content) (const :tag show 
> everything, even drawers showeverything))

This warning is hinting you that (setopt org-startup-folded t) is not the
right thing to do. It will still work though.

Now, it is better to use (setopt org-startup-folded 'fold)

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



Error message after upgrading to devel version: const:tag

2024-05-25 Thread Kepa
Hi

After updating org-mode to org-9.7pre0.20240524.175607

I get this warning message:
■  Warning (emacs): Value 't' does not match type (choice (const :tag nofold: 
show all nofold) (const :tag fold: overview fold) (const :tag fold: show two 
levels show2levels) (const :tag fold: show three levels show3levels) (const 
:tag fold: show four levels show4evels) (const :tag fold: show five levels 
show5levels) (const :tag content: all headlines content) (const :tag show 
everything, even drawers showeverything))

Best regards



dslide 0.4.0, last unstable release

2024-05-25 Thread Psionic K
Dslide (Domain Specific sLIDEs) is a rethought, mostly complete
rewrite of org-tree-slide.

Its highlight features:
- using babel blocks
- per-slide configuration
- extensible via custom actions and support for custom EIEIO classes

There is a file in the /test directory called demo.org.  You can see
the presentation with `dslide-deck-start' or `dslide-deck-develop' to
watch progress updates be highlighted.

You need my other package, `master-of-ceremonies' to complete the last
slides of the presentation.
https://github.com/positron-solutions/master-of-ceremonies

There are a few areas I plan to change where feedback could be
beneficial.  Stop me if any of these choices seem unintuitive.

I plan to get rid of the idea of independent `DSLIDE_SLIDE_ACTION' and
`DSLIDE_SLIDE_CHILD_ACTION' and instead combine the child and slide
behaviors into several distinct slide classes.  The user will set
`DSLIDE_CLASS` to achieve the combination of these two options.  They
will still accept plist style arguments for small behavior tweaks.

Per-slide actions will still be supported, via `DSLIDE_EXTRA_ACTIONS'
or `DSLIDE_ACTIONS' to completely override the normal actions set via
customize or document properties.

A user asked me to enable hiding babel blocks via setting the
`:exports none`.  I'm not sure if this is consistent with other uses
of that option.
My other option was to re-use the babel block keywords that are
usually already present, adding just "hide" to the normal list of
method names.  You can reply directly if you like:
https://github.com/positron-solutions/dslide/issues/1



Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point)

2024-05-25 Thread Ihor Radchenko
Jim Porter  writes:

>> According to the docstring, functions in `forward-thing-provider-alist'
>> should accept a single argument - the number of "things" to skip
>> forward/backward. But it is not what `org-next-link' expects.
>
> In a twist, it turns out *this* patch for Org-mode was correct, and my 
> prior patch for thingatpt.el was wrong. In short, 'forward-thing' now 
> calls the functions in 'forward-thing-provider-alist' with a BACKWARD 
> flag, rather than an integer N. That's because 'forward-thing' needs to 
> account for the case where you have multiple providers for the same 
> "thing", and so it needs to go one at a time checking all the providers 
> for the best match (read: the one that moves point by the smallest 
> non-zero amount).
>
> I've now pushed the thingatpt fix to the Emacs master branch.

Ok. Now, may you also add NEWS entry?

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



Re: [BUG] Failing tests for ob-clojure

2024-05-25 Thread Ihor Radchenko
Ihor Radchenko  writes:
>> I would love to write new tests but as I just started a new job
>> and got a new baby at the same time, I don't think I'll find the
>> time for it the next 3-4 month :(
>
> Understood. We are not in rush.

It has been a while since the last activity in this thread.
Daniel, have you had a chance to look into writing new tests?

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



Re: filling more narrowly --- or unfilling -- for export to email, upon ascii export

2024-05-25 Thread Samuel Wales
for now i am doing   (setq org-ascii-text-width 40).  idk if recipient
devices are smaller, but it doesn't seem too bad if they are not.

On Thursday, May 23, 2024, Samuel Wales  wrote:

> thanks both.
>
> > I write my email using org syntax and then invoke
> >
> > M-x org-mime-htmlize RET
> >
> > just before sending.
>
> i'm guessing that would solve all formatting issues.  not sure how quoting
> [top post or interstitial] conversations would work.
>
> however, last time i tried sending html through webmail, i couldn't gt it
> to send as html, as opposed to html as text.  perthaps there is a trick to
> it.
>
>
> as for ihor's suggestion, i tried (setq org-ascii-text-width
> most-positive-fixnum) and then realized that it would likely wrap plain
> lists thus:
>
>   - this is a list with a really long line which is like an unfilled
> paragraph and here it is filling but not to the fill-prefix org fills it to
>
>
> i'm guessing there is maybe no solution.  [i have had bad luck with geary
> and thunderbird, and unfortunately setting up emacs mail is at this time is
> too much for me [and not as accessible for me as webmail for various
> reasons [including but not limited to full mouseability]].]
>
> the workaround might be to set a really narrow fill column, i wonder?  not
> sure.
>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>
>

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com