Re: [PATCH v2] org-contrib/babel/languages/ob-doc-plantuml.org: ASCII output

2022-08-14 Thread Ihor Radchenko
Joseph Turner  writes:

> Document the new functionality of ob-plantuml to insert ASCII diagrams
> directly in the buffer.
> ---
>  .../babel/languages/ob-doc-plantuml.org   | 57 +++
>  1 file changed, 46 insertions(+), 11 deletions(-)

Thanks!
Applied onto master via e68a7903.
https://git.sr.ht/~bzg/worg/commit/e68a7903a2a85b0deaa8f54d63524045441aeb8d


-- 
Ihor Radchenko,
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



Suggestion: default path for attachments

2022-08-14 Thread Ypo

Could it be possible to customize a default folder for attachments?


- I am using inheritance (org-attach-use-inhetirance).

- But in the headlines in the first level, the :DIR: property needs to 
be set by hand, always.


- I would like to have a default attachment folder which would be 
"inherited" by all headlines.



Not sure if that could be a good idea for "org attach group easy 
customization" menu.


Or if at least I could "hack" it.


Best regards


Re: Suggestion: default path for attachments

2022-08-14 Thread Ihor Radchenko
Ypo  writes:

> Could it be possible to customize a default folder for attachments?
>
>
> - I am using inheritance (org-attach-use-inhetirance).
>
> - But in the headlines in the first level, the :DIR: property needs to 
> be set by hand, always.
>
> - I would like to have a default attachment folder which would be 
> "inherited" by all headlines.

See org-global-properties-fixed

-- 
Ihor Radchenko,
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: Suggestion: default path for attachments

2022-08-14 Thread Ihor Radchenko
Ihor Radchenko  writes:

> See org-global-properties-fixed

Or rather org-global-properties, which is an actual user customization.

-- 
Ihor Radchenko,
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: Suggestion: default path for attachments

2022-08-14 Thread Ypo

Love it. Thanks!

El 14/08/2022 a las 9:36, Ihor Radchenko escribió:

Ihor Radchenko  writes:


See org-global-properties-fixed

Or rather org-global-properties, which is an actual user customization.


Re: how to beamer export overlay figure?

2022-08-14 Thread Max Nikulin

On 13/08/2022 18:39, Fraga, Eric wrote:


+  ((string-match "include\\(graphics\\|svg\\)\\([[{]?\\)" 
latex-link)
+   ;; check for overlay specification and insert if present
+   (replace-match
+(format "include\\1%s\\2"
+(if overlay overlay ""))


ox-latex may wrap \includegraphics into various environments to add 
caption, center figure, etc. Shouldn't :overlay affect all such stuff, 
not just the image?





Re: [PATCH v2] Re: Adding target and custom id links doesn't ask for description

2022-08-14 Thread Max Nikulin

On 13/08/2022 12:01, Ihor Radchenko wrote:

See the updated version of the patch attached. It works on my side.

--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1577,10 +1577,8 @@ (defun org-store-link (arg &optional interactive?)
  t
(setq link (plist-get org-store-link-plist :link))
 ;; If store function actually set `:description' property, use
-;; it, even if it is nil.  Otherwise, fallback to link value.
-   (setq desc (if (plist-member org-store-link-plist :description)
-   (plist-get org-store-link-plist :description)
-link)))
+;; it, even if it is nil.  Otherwise, fallback to nil (ask user).
+   (setq desc (plist-get org-store-link-plist :description)))


I can not say that I understand design of `org-store-link` and 
`org-insert-link' pair, but I suspect that you might try to fix the 
issue in a wrong place.


It seems the same :link and :description value were set for purpose, see 
`org-insert-link' code:


(dolist (l org-stored-links)
  (when (equal link (cadr l))
(setq link (car l))
(setq auto-desc t)))

However I am puzzled by

(unless auto-desc

I would say that namely the same :link and :description should cause 
query to default description and user prompt.


I may be wrong. Maybe the protocol of communication between these 
functions may be documented with more details.





Re: Bug: org-store-link uses CUSTOM_ID instead of target point [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2022-08-14 Thread Max Nikulin

On 06/11/2021 19:51, Max Nikulin wrote:

On 06/05/2021 19:41, Bastien wrote:

Fr Ml writes:


I have a problem with the function org-store-link it doesn't work as
described in the documentation:
https://orgmode.org/manual/Handling-Links.html
"For Org files, if there is a '<>' at point, the link points
to
the target."


Fixed in maint, thanks a lot for reporting this and Ihor for
confirming the bug.


Another issue likely caused by this change:

Carlos Pita to emacs-orgmode. Adding target and custom id links doesn't 
ask for description. Tue, 2 Aug 2022 14:44:58 -0300.

https://list.orgmode.org/d99a712c-18d1-4a4f-8093-35a0bfb46...@gmail.com

Bastien, unfortunately your fix caused duplication of stored links like 
"file:~/org/file.org::#custom_id" when point is outside of <>. 
Earlier #CUSTOM_ID link was stored in addition to 
"file:~/org/file.org::*Heading" search link. My suggestion is to revert 
your patch and to just reset custom-id variable when <> link is 
stored. Another effect or your patch, that I consider unintentional, is 
storing 
[[file:~/org/file.org::#custom_id][file:~/org/file.org::#custom_id]] 
instead of [[file:~/org/file.org::#custom_id][Heading]]. I prefer 
"original" behavior.


Third patch is intended to avoid links inserted as 
[[target][file:~/org/file.org::target]] in the case of same file. I 
suppose, just [[target]] is better. Current variant looks unbalanced and 
misleading. Of course, you are free to skip last patch.


I am confused by `org-insert-link' behavior. It inserts links like 
[[file:~/org/file.org::#custom_id][file:~/org/file.org::#custom_id]] 
without user prompt for description but 
[[file:~/org/file.org::#custom_id][Heading]] requires to confirm 
"Heading" description explicitly. I would expect that "raw" link is 
subject to ask user for more friendly option.








Re: how to beamer export overlay figure?

2022-08-14 Thread Fraga, Eric
On Sunday, 14 Aug 2022 at 16:30, Max Nikulin wrote:
> ox-latex may wrap \includegraphics into various environments to add
> caption, center figure, etc. Shouldn't :overlay affect all such stuff,
> not just the image?

I guess so, in principle.  However, this is beamer so some of these
don't apply (e.g. captions) in most cases.  The more likely scenario is
that the figure is within a "block" and we can already put an overlay on
the block.

-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50


[PATCH v2] ol-info: Define :insert-description function

2022-08-14 Thread Max Nikulin

On 06/08/2022 14:00, Ihor Radchenko wrote:

Max Nikulin writes:


+If LINK is not an info link then DESC is returned."
+  (or (org-string-nw-p desc)
+  (let* ((file-node (org-info-link-file-node link))
+ (file (car file-node))
+ (node (cadr file-node)))


pcase-let would be shorter here.


I have rewritten the patch to use `pcase' and to fix allowed separators 
between file name and node.


I have realized that unlike other type specific functions, 
:insert-description receives link including "scheme:" prefix. However 
attempt to achieve consistency at this point may cause more problems.From 7aeaa36ee1b30aa1c9711fe76e151ec956199f27 Mon Sep 17 00:00:00 2001
From: Max Nikulin 
Date: Sat, 30 Jul 2022 19:13:01 +0700
Subject: [PATCH v2] ol-info: Define :insert-description function

* lisp/ol-info.el (org-info--link-file-node): New helper to parse info
link info file (manual) name and node.
(org-info-follow-link, org-info-export): Use `org-info--link-file-node'.
(org-info-description-as-command): New function to create description
for info links that may executed to view the manual.
(org-link-parameters): Specify `org-info-description-as-command' as
`:insert-description' for info links.
(org-info-other-documents): Add URL of directory index.
* testing/lisp/test-org-info.el (test-org-info/export): Add cases for
texinfo export with link description.
(test-org-info/link-file-node, test-org-info/description-as-command):
New tests for new functions `org-info--link-file-node' and
`org-info-description-as-command'.

Use recently added :insert-description feature of `org-link'.
Alternative separators between file name and node ":", "::", "#:"
are preserved.  Added interpretation of empty path as dir index,
Org manual is assumed if file is not specified for given node.
---
 lisp/ol-info.el   | 85 ++-
 testing/lisp/test-org-info.el | 82 -
 2 files changed, 146 insertions(+), 21 deletions(-)

diff --git a/lisp/ol-info.el b/lisp/ol-info.el
index dc5f6d5ba..0584e6f8c 100644
--- a/lisp/ol-info.el
+++ b/lisp/ol-info.el
@@ -30,6 +30,7 @@
 
 ;;; Code:
 
+(require 'subr-x) ; `string-trim', `string-remove-prefix'
 (require 'ol)
 
 ;; Declare external functions and variables
@@ -43,7 +44,8 @@
 (org-link-set-parameters "info"
 			 :follow #'org-info-open
 			 :export #'org-info-export
-			 :store #'org-info-store-link)
+			 :store #'org-info-store-link
+ :insert-description #'org-info-description-as-command)
 
 ;; Implementation
 (defun org-info-store-link ()
@@ -63,24 +65,68 @@
   "Follow an Info file and node link specified by PATH."
   (org-info-follow-link path))
 
+(defun org-info--link-file-node (path)
+  "Extract file name and node from info link PATH.
+
+Return cons consisting of file name and node name or \"Top\" if node
+part is not specified. Components may be separated by \":\" or by \"#\"."
+  (if (not path)
+  '("dir" . "Top")
+(string-match "\\`\\([^#:]*\\)\\(?:[#:]:?\\(.*\\)\\)?\\'" path)
+(let* ((node (match-string 2 path))
+   ;; `string-trim' modifies match
+   (file (string-trim (match-string 1 path)))
+   (has-file (org-string-nw-p file))
+   (has-node (org-string-nw-p node)))
+  (cons
+   ;; Fallback to "org" is an arbirtrary choice
+   ;; and added because "(dir)filename" does not work as "filename".
+   (if has-file file (if has-node "org" "dir"))
+   (if has-node (string-trim node) "Top")
+
+(defun org-info-description-as-command (link desc)
+  "Info link description that can be pasted as command.
+
+For the following LINK
+
+\"info:elisp#Non-ASCII in Strings\"
+
+the result is
+
+info \"(elisp) Non-ASCII in Strings\"
+
+that may be executed as shell command or evaluated by
+\\[eval-expression] (wrapped with parenthesis) to read the manual
+in Emacs.
+
+Calling convention is similar to `org-link-make-description-function'.
+DESC has higher priority and returned when it is not nil or empty string.
+If LINK is not an info link then DESC is returned."
+  (let* ((prefix "info:")
+ (need-file-node (and (not (org-string-nw-p desc))
+  (string-prefix-p prefix link
+(pcase (and need-file-node
+(org-info--link-file-node (string-remove-prefix prefix link)))
+  ;; Unlike (info "dir"), "info dir" shell command opens "(coreutils)dir invocation"
+  (`("dir" . "Top") "info \"(dir)\"")
+  (`(,file . "Top") (format "info %s" file))
+  (`(,file . ,node) (format "info \"(%s) %s\"" file node))
+  (_ desc
 
 (defun org-info-follow-link (name)
   "Follow an Info file and node link specified by NAME."
-  (if (or (string-match "\\(.*\\)\\(?:#\\|::\\)\\(.*\\)" name)
-  (string-match "\\(.*\\)" name))
-  (let ((filename (match-string 1 name))
-	(nodename-or-index (or (match-string 2 name) "Top")))
-	(require 'info)
-	;; If nodename-or

Re: Bug? org-id-find not finding some IDs

2022-08-14 Thread Jack Kamm
Ihor Radchenko  writes:

> Applied onto main via 8f5bf1725.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=8f5bf172556564df89fb16ce8ecec68c5b7f0221

My sincere apologies, but after a bit of testing, I found that my
requested change had some unforeseen consequences, and I don't think
it's a good idea anymore. So, I'd like to request reverting it.

Doing some research, I found the behavior of org-id-update-id-locations,
to not search all the open Org files, was made in this 2019 commit:

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9865e6bd8be65229be4eac4f459f62e47fab2be7

The commit message suggests this change in behavior was
intentional. Only, the docstring of org-id-extra-files wasn't updated to
reflect the new behavior, which was the cause of confusion on my end.

In terms of unforeseen consequences of the new commit: I found it caused
some problems for org-caldav. When making changes, org-caldav copies
entries into a backup file at ~/.emacs.d/org-caldav-backup.org. With the
new commit, it is sometimes finding entries in this backup file instead
of the correct file.

To fix the original problem I was experiencing with org-caldav, I think
it may be better to modify org-caldav, instead of upstream Org-mode. To
that end, I submitted this PR to org-caldav:

https://github.com/dengste/org-caldav/pull/250



Fwd: bug#57213: 27.1; statistics of repeated tasks

2022-08-14 Thread Ihor Radchenko
Forwarding from debbugs.

Abhisek, we usually discuss Org development in a dedicated mailing list.
See https://orgmode.org/manual/Feedback.html

As for your suggestion, the idea is reasonable. Patches are welcome :)

Note that statistic cookies have a very specific format [NN%] or [N/M].
I guess you can treat, say, [NN%] as percentage of time the habit was
actually done vs. planned to be done.

Also, you may modify org-habit-insert-consistency-graphs to provide more
statistic information.


 Start of forwarded message 
Subject: bug#57213: 27.1; statistics of repeated tasks
To: 57...@debbugs.gnu.org
From: Abhisek Panigrahi 
Date: Sun, 14 Aug 2022 23:00:22 +0530

I can't seem to find statistics of repeated tasks. However, I can see the
cookies of the TODO tasks like
https://orgmode.org/manual/Breaking-Down-Tasks.html. I'm using the
editor for more than 5 years now and org-mode for more than 2
years. There is some solution for every area of editing, however when I
tried to see how many times I have completed a specific task, there is
no way.

There are some hacks I found on the internet, but either that is
incomplete or unusable. I don't know why it isn't builtin yet ?
This feature is very useful inside *habit* module atleast. Because by
seeing your statistics you get motivated and want to keep the streak
going.

Some suggestion to include in this feature
* last streak count
* highest streak count
* total times the task was DONE

If you feel there are some additional statistics or different useful
statistics should be included, please do so. I would be glad to be in
the discussion.





In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-21 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Home Single Language
(v10.0.2009.19044.1889)

Recent messages:
Entry repeats: SCHEDULED: <2022-08-16 Tue .+2d>
Note stored
Entry repeats: SCHEDULED: <2022-08-16 Tue .+2d>
Saving file d:/schedules/example.org...
Wrote d:/schedules/example.org
Saving file d:/schedules/example.org...
Wrote d:/schedules/example.org
Saving file d:/schedules/example.org...
Wrote d:/schedules/example.org
Press key for agenda command (unrestricted):

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENN
  locale-coding-system: cp1252

Major mode: Org-Agenda Week Ddl Grid Habit

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail cl-extra org-lint ox-odt
rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table
ox-ascii ox-publish ox org-habit thingatpt help-fns radix-tree help-mode
cus-edit cus-start cus-load org-timer org-colview org-clock org-attach
org-id org-archive cal-move diary-lib diary-loaddefs cal-iso org-agenda
misearch multi-isearch mule-util info org-element avl-tree generator
ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnir gnus-sum url
url-proxy url-privacy url-expand url-methods url-history mailcap shr
url-cookie url-domsuf url-util svg xml dom gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message rmc puny rfc822
mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search mail-utils mm-util mail-prsvr wid-edit ol-docview
doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex bibtex
ol-bbdb ol-w3m org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color
ring org-list org-faces org-entities time-date noutline outline
easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat advice org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs warnings edmacro kmacro infodoc-theme
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel d