[C-c C-q] org-set-tags-command completed tags does not contains current buffer local tags

2024-04-17 Thread Christopher M. Miles

In the [C-c C-q] org-set-tags-command, I found it does not complete tags in 
current buffer.

#+begin_src emacs-lisp
(defun org-set-tags-command ( arg)
  ...
  (let* (...
 (local-table (or org-current-tag-alist (org-get-buffer-tags)))
 ;; the `org-current-tag-alist' is from my customized 
`org-tag-persistent-alist'.
 ...)))
#+end_src

Steps to reproduce:

1. create an empty Org mode file and open it as a Emacs buffer.
2. Fill in Org content as bellowing

#+begin_src org
* headline 1  :tag1:workflow:

* headline 2 :tag2:name:
#+end_src

3. save buffer
4. Press [C-c C-q] org-set-tag-command
5. You can't see buffer local tags "tag1", "tag2", "workflow", "name" in tags 
completion.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Let `org-element-at-point` or `org-element-context` return element type "tags" when point on tags.

2024-04-07 Thread Christopher M. Miles

When I move point on the headline tags position. I evaluate
`(org-element-at-point)` or `(org-element-context)`, both return element
type is `(headline )`. I hope those two functions can return more
explicit element type like "tags".

I tried to find this type API function in existing functions. But I have
not found. If someone knows, please let me know. I use this function to
detect whether current point is on tags element. I try to write a simple
extension to display tag explanation info through eldoc.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Bug: org-no-popups disregards display-buffer-fallback-action [9.4.6 (9.4.6-13-g4be129-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20210920/)]

2024-02-07 Thread Christopher M. Miles

+1!

Ihor Radchenko  writes:

> I conclude that `org-no-popups' and `org-switch-to-buffer-other-window'
> should not be used in Org mode.
>
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=78dc58508
>
> Other issues raised in this thread need more thought.


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [POLL] Change calling convention for when `org-link-file-path-type' is set to custom function (was: Enhancement Proposal for 'org-link-file-path-type' Behavior)

2024-01-16 Thread Christopher M. Miles

+1 for this propose.

I have one situation need this feature.

Assume a file structure like bellowing:

#+begin_example
`- folder-1
  `- file-1.org
  `- folder-1.2
` file-1.2.1.org
#+end_example

When I try to add link of "file-1.org" in "file-1.2.1.org", based on my
custom option `org-link-file-path-type' value `adaptive'. The link will
become a full-path link. But I want link to be relative to current Org
file path. The file link path should be [[file:../file-1.org]] instead
of [[file:folder-1/file-1.org]]. I hope I can use a custom function in
conditions to decide the file path.

Ihor Radchenko  writes:

> 西 顾  writes:
>
>> I'd like to suggest a small enhancement to the
>> 'org-link-file-path-type' option. When set to 'function', it currently
>> passes an absolute path to the user's custom function. This limits
>> flexibility as the original path input is not available to the
>> function.
>>
>> For better customization, I propose passing the raw path to the
>> function. Users needing an absolute path could use 'expand-file-name'
>> within their function.
>
> Thanks for the suggestion!
>
> This makes sense - the current approach with passing absolute path is
> indeed limiting the information passed to the custom function.
>
> The docstring is also quite ambiguous about what is passed as an
> argument:
>
> org-link-file-path-type is a customizable variable defined in ol.el.
> <...>
> Alternatively, users may supply a custom function that takes the
> full filename as an argument and returns the path.
>
> "full filename" may or may not mean "absolute filename".
>
> However, changing the absolute path to "as is" path will technically be
> breaking.
>
> I cannot find any actual uses of custom function value for
> `org-link-file-path-type' in the wild, so I am leaning towards going
> ahead with this (minor) breaking change.
>
> Yet, I am starting a poll to give users who may be affected a chance to
> chime in.


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[DONE] Re: org-agenda + [a] generated many duplicated task entries

2024-01-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> When I execute command "org-agenda" with key "[a]" to generate
>> org-agenda day view. Many task entries are duplicated.
>
> Maybe you have something in
> `org-agenda-skip-scheduled-if-deadline-is-shown' or similar customization.
>
>> I tried many methods trying to figure out the problem reason.
>>
>> - [X] Emacs init bisect
>> - [X] Emacs minimal init testing -> no problem
>
> These two mean that you missed something during bisection.

I reproduced the problem with `emacs -Q` and `emacs-minimal-init`.
Then I tried to Edebug on the command function `org-agenda` -> 
`org-agenda-list`.
I suddenly brain come up with checking out the variable `org-agenda-files` 
value.
I found it contains duplicated filenames in list.
Then I added `delete-dups` function around my `org-agenda-files` value list 
generating.
Then the problem solved.

This is really a hard reason to find out which costed lot of time. :(

Anyway, thanks Ihor as always.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: org-agenda + [a] generated many duplicated task entries

2024-01-16 Thread Christopher M. Miles

@Ihor, Thanks for your help.

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> When I execute command "org-agenda" with key "[a]" to generate
>> org-agenda day view. Many task entries are duplicated.
>
> Maybe you have something in
> `org-agenda-skip-scheduled-if-deadline-is-shown' or similar customization.
>

I customized `org-agenda-skip-scheduled-if-deadline-is-shown' to `t' in my 
Emacs init.

After your hints, I tested this option with different values:
`nil', `t', `not-today', `repeated-after-deadline'.

None of those value fixed my problem. So should not related to my problem.

I have customized options in my Emacs init:

#+begin_src emacs-lisp
(setq org-agenda-skip-timestamp-if-done t
  org-agenda-skip-deadline-if-done t
  org-agenda-skip-deadline-prewarning-if-scheduled t
  org-agenda-skip-scheduled-if-done t
  org-agenda-skip-scheduled-delay-if-deadline 'post-deadline
  org-agenda-skip-scheduled-if-deadline-is-shown t
  org-agenda-skip-timestamp-if-deadline-is-shown t
  org-agenda-skip-additional-timestamps-same-entry nil
  org-deadline-warning-days 14
  org-agenda-tags-todo-honor-ignore-options t)

(setq org-agenda-todo-ignore-timestamp 'all
  org-agenda-todo-ignore-with-date nil
  org-agenda-todo-ignore-scheduled 'future
  org-agenda-todo-ignore-deadlines 'near)
#+end_src

But I tested by comment out those options still have same problem.

>> I tried many methods trying to figure out the problem reason.
>>
>> - [X] Emacs init bisect
>> - [X] Emacs minimal init testing -> no problem
>
> These two mean that you missed something during bisection.

Yes, this is why I post email here for asking help. Because I can't find
out reason between Emacs init bisect & Emacs minimal init testing.

I will try more times and other methods.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [External] [FR] Add buffer-local setting to request specific ESS process/session name (was: [PATCH] Set Python shell in Org edit buffer)

2024-01-12 Thread Richard M. Heiberger
This idiscussion s reminding me of the following ESS functions

ess-add-ess-process   M-x ... RET
   Execute this command from within a buffer running a process to add
ess-request-a-process M-x ... RET
   Ask for a process, and make it the current ESS process.
ess-switch-processM-x ... RET
   Force a switch to a new underlying process.

Are these relevant to the question?

Rich

> On Jan 10, 2024, at 15:15, Ihor Radchenko  wrote:
>
> "Sparapani, Rodney"  writes:
>
>> I see.  But, I assume that you meant…
>> 8. Observe that the line still goes to "session1"
>
> Yup.
>
>> I usually launch another emacs for “session2”.
>> There’s probably a way to do this manually,
>> but, I take your point.  However, if you are a
>> non-user, then why do you care?
>
> Org mode supports multiple ESS sessions in Org mode src blocks
> (https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html#org2a21acd)
>
> However, we currently have to use a workaround that does not always work
> well to assign separate sessions to R source blocks in Org mode.
> ESS is the only comint mode that requires such workaround and does not
> allow setting a specific process buffer name for a given R buffer.
>
> We recently discovered `ess-gen-proc-buffer-name-function', but it does
> not work as we expected, unfortunately. (which is either because we
> misunderstand something or because there is a bug).
>
> --
> 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>
>
> ___
> ESS-core list: https://stat.ethz.ch/mailman/listinfo/ess-core



Re: [PATCH] Set Python shell in Org edit buffer

2024-01-11 Thread Christopher M. Miles

Ihor Radchenko  writes:

> Now, the question is what to do with the existing implementation of
> `org-src-associate-babel-session'. It only runs
> org-babel--associate-session when
>
> (and session (not (string= session "none"))
>(org-babel-comint-buffer-livep session)
>(let ((f (intern (format "org-babel-%s-associate-session"
>   (nth 0 info)
>(and (fboundp f) (funcall f session
>
> The questionable check here is (org-babel-comint-buffer-livep session) -
> it only triggers when session is already initiated, while ob-python and
> some other backends do not necessarily need to start a new session to
> "associate" it with Org Src buffer.
>
> I am tentatively inclined to change this check to
>
> (or (org-babel-comint-buffer-livep session)
> (eq org-src-auto-initiate-session t)
> (alist-get (nth 0 info) org-src-auto-initiate-session)
> (alist-get 'default org-src-auto-initiate-session))
>
> With `org-src-auto-initiate-session' being a customization that controls
> whether to associate session for a given babel backend.
>
> We may set the default value to something like
>
> ((default . t) ("R" . nil))

I think this customization is reasonable. Agree to make it as a
customization option, The ob-clojure CIDER session which managed by
"sesman" seems also requires buffer associate with session.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH v6] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2024-01-11 Thread Christopher M. Miles

Thanks for updating, this patch looks great to me.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


OrgMode Agenda empty if one of files is missing

2023-12-05 Thread Ali M.
Hi ,

If a file added on my agenda list is deleted, Org Mode Agenda list comes
back empty

for example my org agenda have two files
 '(org-agenda-files
   '("c:/dev/projects/one/one.org"  "c:/dev/projects/two/two.org"  ))

Now I deleted folder two , so the folder  c:/dev/projects/two/ and its
content is also deleted

Now when I try C-ca and select any of the option to list my scheduled todos
I get an empty *Org Agenda* buffer

Removing the deleted folder from my org-agenda-files, fixes the issue

I think the Agenda buffer should still show me the todo items from the
available files, and maybe just warn me about the delete file, or at least
show nothing, but warn me about the issue

Thanks
Ali


Re: OrgMode Agenda empty if one of files is missing from the org-agenda-files

2023-12-04 Thread Ali M.
You are right

I tried again, and this time, i checked the echo/mini buffer area, and it
had the options you mentioned above
my bad

My agenda windows open on the side, not the bottom (not sure why), so i
guess this why i didnt notice the warning in the echo area before
also a bit unfortunate that a is for abort because i might have kept
pressing a when i first got a blank windows (also a being the first option
for agenda, and the thing you will most likely try as a new user)

Anyway, thanks



On Mon, Dec 4, 2023 at 10:06 AM Ihor Radchenko  wrote:

> "Ali M."  writes:
>
> > If a file added on my agenda list is deleted, Org Mode Agenda list comes
> > back empty
> >
> > For example, my org agenda has two files
> >  '(org-agenda-files
> >'("c:/dev/projects/one/one.org"  "c:/dev/projects/two/two.org"  ))
> >
> > Now I deleted folder two , so the folder  c:/dev/projects/two/ and its
> > content is also deleted
> >
> > Now when I try C-ca and select any of the option to list my scheduled
> todos
> > I get an empty *Org Agenda* buffer
>
> This is not what I am seeing on my side.
> For me, agenda displays a message:
>
> Non-existent agenda file /tmp/two/two.org.  [R]emove from list or [A]bort?
>
> If I press "r", the agenda is displayed with the existing file.
> If I press "a", agenda generation is aborted.
>
> > I think the Agenda buffer should still show me the todo items from the
> > available files, and maybe just warn me about the delete file, or at
> least
> > show nothing, but warn me about the issue
>
> I suspect that you accidentally pressed "a" extra time, which happened
> to trigger "[A]bort".
>
> --
> 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>
>


OrgMode Agenda empty if one of files is missing from the org-agenda-files

2023-12-03 Thread Ali M.
Hi ,
This is a repost, the first i sent this to the mailing list i
wasnt subscribed so it is pending review, but it's been almost a week, so i
sending this again after i subscribed

If a file added on my agenda list is deleted, Org Mode Agenda list comes
back empty

For example, my org agenda has two files
 '(org-agenda-files
   '("c:/dev/projects/one/one.org"  "c:/dev/projects/two/two.org"  ))

Now I deleted folder two , so the folder  c:/dev/projects/two/ and its
content is also deleted

Now when I try C-ca and select any of the option to list my scheduled todos
I get an empty *Org Agenda* buffer

Removing the deleted folder from my org-agenda-files, fixes the issue

I think the Agenda buffer should still show me the todo items from the
available files, and maybe just warn me about the delete file, or at least
show nothing, but warn me about the issue

Thanks
Ali


Getting email from MS outlook into emacs

2023-11-27 Thread Doyley, Marvin M.
Hi there,

I have been trying to configure mbsync to download email from MS Outlook.  
Unfortunately, the new oauth2 authentication makes things difficult, especially 
since my institution has disabled the Azure App permission.

Does anybody have a workaround?  I just want the email message to be linked to 
my todos, which is almost impossible.  I am working on a Mac and org-mac-link 
just hangs when I try to grab Outlook emails.


Thanks in advance for your help.

Cheers,
M

PS I have also tried Davmail, which almost worked, except my institution placed 
another roadblock.

Marvin M. Doyley, Ph.D.
Wilson Professor of Electronic Imaging
Professor and Chair of the Department of Electrical and Computer Engineering,
Professor of Biomedical Engineering
Professor Imaging Sciences,
University of Rochester
518 Computer Studies Building Rochester NY 14627
Tel: 585-275-3774 Fax: 585-273-4919
Website: http://www.ece.rochester.edu/projects/doyley_lab/




[BUG] `org-element-at-point-no-context' error in flyspell `org-mode-flyspell-verify'

2023-11-06 Thread Christopher M. Miles

I got following error:

#+begin_example
Please report this to Org mode mailing list (M-x org-submit-bug-report).
⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
Code.org::434180. Resetting.
 The error was: (wrong-number-of-arguments ((t) nil "Return outline-regexp with 
limited number of levels.
The number of levels is controlled by `org-inlinetask-min-level'." (cond ((not 
(derived-mode-p 'org-mode)) outline-regexp) ((not (featurep 'org-inlinetask)) 
org-outline-regexp) (t (let* ((limit-level (1- org-inlinetask-min-level)) 
(nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level))) (format 
"\\*\\{1,%d\\} " nstars) 1)
 Backtrace:
"  backtrace-to-string(nil)
  (progn (backtrace-to-string (backtrace-get-frames 'backtrace)))
  (if (and (fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) 
(progn (backtrace-to-string (backtrace-get-frames 'backtrace
  (format \"Org parser error in %s::%S. Resetting.\\n The error was: %S\\n 
Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and 
(fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) (progn 
(backtrace-to-string (backtrace-get-frames 'backtrace)
  (let* ((format-string (format \"Org parser error in %s::%S. Resetting.\\n The 
error was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list 
(M-x org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and 
(fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) (progn 
(backtrace-to-string (backtrace-get-frames ...)) (format-string (if (or 
(not org-element--cache-diagnostics-ring) (not (eq 'backtrace 
org-element--cache-self-verify))) format-string (prog1 (concat (format 
\"Warning(%s): \" (buffer-name ...)) format-string \"\\nBacktrace:\\n  \" 
(mapconcat #'identity (ring-elements org-element--cache-diagnostics-ring) \"\\n 
 \")) (setq org-element--cache-diagnostics-ring nil) (if (and (boundp 
'org-batch-test) org-batch-test) (error \"%s\" (concat \"org-element--cache: \" 
format-string)) (display-warning 'org-element-cache (concat 
\"org-element--cache: \" format-string
  (condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and ... 
...) (progn ... (format-string (if (or (not 
org-element--cache-diagnostics-ring) (not ...)) format-string (prog1 (concat 
... format-string \"\\nBacktrace:\\n  \" ...) (setq 
org-element--cache-diagnostics-ring nil) (if (and (boundp 'org-batch-test) 
org-batch-test) (error \"%s\" (concat \"org-element--cache: \" format-string)) 
(display-warning 'org-element-cache (concat \"org-element--cache: \" 
format-string (org-element-cache-reset) (org-element--parse-to epom)))
  (if cached-only (if (and (org-element--cache-active-p) (or (not 
org-element--cache-sync-requests) (< epom (aref (car 
org-element--cache-sync-requests) 1 (progn (org-element--cache-find epom))) 
(condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name ...) epom err (if ... ...))) 
(format-string (if (or ... ...) format-string (prog1 ... ... (if (and 
(boundp 'org-batch-test) org-batch-test) (error \"%s\" (concat 
\"org-element--cache: \" format-string)) (display-warning 'org-element-cache 
(concat \"org-element--cache: \" format-string (org-element-cache-reset) 
(org-element--parse-to epom
  (setq element (if cached-only (if (and (org-element--cache-active-p) (or (not 
org-element--cache-sync-requests) (< epom (aref (car 
org-element--cache-sync-requests) 1 (progn (org-element--cache-find epom))) 
(condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" ... epom err ...)) (format-string (if ... 
format-string ...))) (if (and (boundp ...) org-batch-test) (error \"%s\" 
(concat \"org-element--cache: \" format-string)) (display-warning 
'org-element-cache (concat \"org-element--cache: \" format-string 
(org-element-cache-reset) (org-element--parse-to epom)
  (let (element) (if (org-element--cache-active-p) (progn (if (not 
(save-current-buffer (set-buffer (or ... ...)) org-element--

[BUG] `org-todo` [C-c C-t] got error (args-out-of-range # 0 48016)

2023-11-06 Thread Christopher M. Miles

Here is the backtrace after I toggled debug-on-error:


#+begin_example
Debugger entered--Lisp error: (args-out-of-range # 0 
48016)
  replace-match("")
  (progn (goto-char (match-beginning 0)) (replace-match "") 
(insert-before-markers-and-inherit next) (if (org-invisible-p 
(line-beginning-position)) nil (org-fold-region (line-beginning-position) 
(line-end-position) nil)))
  (unwind-protect (progn (goto-char (match-beginning 0)) (replace-match "") 
(insert-before-markers-and-inherit next) (if (org-invisible-p 
(line-beginning-position)) nil (org-fold-region (line-beginning-position) 
(line-end-position) nil))) (setq org-fold-core--last-buffer-chars-modified-tick 
(buffer-chars-modified-tick)))
  (let ((org-fold-core--ignore-modifications t)) (unwind-protect (progn 
(goto-char (match-beginning 0)) (replace-match "") 
(insert-before-markers-and-inherit next) (if (org-invisible-p 
(line-beginning-position)) nil (org-fold-region (line-beginning-position) 
(line-end-position) nil))) (setq org-fold-core--last-buffer-chars-modified-tick 
(buffer-chars-modified-tick
  (let* ((match-data (match-data)) (startpos (copy-marker 
(line-beginning-position))) (force-log (and (equal arg '...) (prog1 t (setq arg 
nil (logging (let ((saved-match-data ...)) (unwind-protect (progn ...) 
(set-match-data saved-match-data t (org-log-done org-log-done) 
(org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) 
(org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) 
org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) 
(head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) 
(interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) 
(org-last-state (or this "")) (completion-ignore-case t) (member (member this 
org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((eq arg ...) (if 
this ... ...)) ((eq arg ...) (if ... nil ...)) (arg (cond ... ... ... ... ... 
... ... ...)) ((and org-todo-key-trigger org-use-fast-todo-selection) 
(org-fast-todo-selection this)) ((null member) (or head ...)) ((equal this 
final-done-word) nil) ((null tail) nil) ((memq interpret ...) (if ... ... ...)) 
(t (car tail (org-state (or (run-hook-with-args-until-success 
'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if 
(org-string-nw-p org-state) (concat " " org-state " ") " ")) (change-plist 
(list :type 'todo-state-change :from this :to org-state :position startpos)) 
dolog now-done-p) (if org-blocker-hook (progn (let (org-blocked-by-checkboxes 
block-reason) (setq org-last-todo-state-is-todo (not ...)) (if (save-excursion 
...) nil (setq block-reason ...) (if ... ... ... ...) (store-match-data 
match-data) (let ((org-fold-core--ignore-modifications t)) (unwind-protect 
(progn (goto-char (match-beginning 0)) (replace-match "") 
(insert-before-markers-and-inherit next) (if (org-invisible-p ...) nil 
(org-fold-region ... ... nil))) (setq 
org-fold-core--last-buffer-chars-modified-tick (buffer-chars-modified-tick 
(cond ((and org-state (equal this org-state)) (message "TODO state was already 
%s" (org-trim next))) ((not (pos-visible-in-window-p hl-pos)) (message "TODO 
state changed to %s" (org-trim next (if head nil (progn (setq head 
(org-get-todo-sequence-head org-state)) (setq ass (assoc head 
org-todo-kwd-alist)) (setq interpret (nth 1 ass)) (setq done-word (nth 3 ass)) 
(setq final-done-word (nth 4 ass (if (memq arg '(nextset previousset)) 
(progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length 
...)) (length org-todo-sets) (mapconcat 'identity (assoc org-state 
org-todo-sets) " " (setq org-last-todo-state-is-todo (not (member org-state 
org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) 
(not (member this org-done-keywords (and logging (org-local-logging 
logging)) (if (or (and (or org-todo-log-states org-log-done) (not (eq 
org-inhibit-logging t)) (not (memq arg ...))) force-log) (progn (setq dolog (or 
(if force-log ...) (nth 1 ...) (nth 2 ...))) (if (and (eq dolog ...) (eq 
org-inhibit-logging ...)) (progn (setq dolog ...))) (if (or (and ... ...) (and 
org-state ... ...)) (progn (org-add-planning-info nil nil ...))) (if (and 
now-done-p org-log-done) (progn (org-add-planning-info ... ...) (if ... ...))) 
(if (and org-state dolog) (progn (org-add-log-setup ... org-state this 
dolog) (org-todo-trigger-tag-changes org-state) (if org-auto-align-tags 
(progn (org-align-tags))) (if org-provide-todo-statistics (progn 
(org-update-parent-todo-statistics))) (if (and (boundp 
'org-clock-out-when-done) org-clock-out-when-done) (progn 
(org-clock-out-if-current))) (run-hooks 'org-after-todo-state-change-hook) (if 
(and arg (not (member org-state org-done-keywords))) (progn (setq head 
(org-get-todo-sequence-head org-state (put-text-property 
(line-beginning-position) (line-end-position) 'org-todo-head head) (if 
now-done-p (progn (if 

Re: Unclear where ob-spice.el is being maintained

2023-08-29 Thread Christopher M. Miles

Thanks, Updated now.

Jonas Bernoulli  writes:

> "Christopher M. Miles"  writes:
>
>> Jonas Bernoulli  writes:
>>
>>> In 2022 I changed Melpa to get ob-spice.el from
>>> https://repo.or.cz/ob-spice.git in response to
>>> https://github.com/melpa/melpa/issues/7872#issuecomment-1034945112.
>>>
>>> But org-contrib still contains that file and the README at the new
>>> location still contains
>>>
>>>> This source code is from [[https://github.com/tiagoweber][tiagoweber]].
>>>
>>> and
>>>
>>>> * Project status
>>>>
>>>> I put it in Org-mode contrib/ now.
>>>
>>> So... is this now being maintained by Stardiviner, at repo.or.cz,
>>> or not?
>>>
>>> If so, please update the README at the new location and remove the
>>> library from org-contrib.
>>>
>>>  Cheers,
>>>  Jonas
>>
>> The new repo https://repo.or.cz/ob-spice.git is maintained by me
>> (stardiviner).
>
> Yes, I know you are the maintainer now and that you maintain the
> package at https://repo.or.cz/ob-spice.git.
>
> However https://repo.or.cz/ob-spice.git/blob/HEAD:/README says:
>
> ,
> | * Project status
> | 
> | I put it in Org-mode contrib/ now.
> `
>
> I read this as "this package is being maintained in the "contrib/"
> directory of Org-mode."  It seems to me, this should just be removed.
>
> Further up in the same file it says:
>
> ,
> | * History
> | 
> | This source code is from [[https://github.com/tiagoweber][tiagoweber]].
> |  
> | - The first version is from 
> [[http://tiagoweber.github.io/blog/entry1.html][here]].
> | - The second version is from 
> [[http://tiagoweber.github.io/blog/entry4.html][here]].
> `
>
> This reads to me like "this is my personal fork of
> https://github.com/tiagoweber;.
>
> How about replacing all that with?:
>
> ,
> | ob-spice is now being maintained at https://repo.or.cz/ob-spice.
> | 
> | This package was originally written by 
> [[https://github.com/tiagoweber][Tiago Weber]].
> | You can find more (potentially outdated) information by him about
> | this package [[http://tiagoweber.github.io/blog/entry1.html][here]]
> | and [[http://tiagoweber.github.io/blog/entry4.html][here]].
> `


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Unclear where ob-spice.el is being maintained

2023-08-27 Thread Christopher M. Miles

Jonas Bernoulli  writes:

> In 2022 I changed Melpa to get ob-spice.el from
> https://repo.or.cz/ob-spice.git in response to
> https://github.com/melpa/melpa/issues/7872#issuecomment-1034945112.
>
> But org-contrib still contains that file and the README at the new
> location still contains
>
>> This source code is from [[https://github.com/tiagoweber][tiagoweber]].
>
> and
>
>> * Project status
>>
>> I put it in Org-mode contrib/ now.
>
> So... is this now being maintained by Stardiviner, at repo.or.cz,
> or not?
>
> If so, please update the README at the new location and remove the
> library from org-contrib.
>
>  Cheers,
>  Jonas

The new repo https://repo.or.cz/ob-spice.git is maintained by me (stardiviner).

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Unclear where ob-spice.el is being maintained

2023-08-27 Thread Christopher M. Miles

Jonas Bernoulli  writes:

> Ihor Radchenko  writes:
>
>> Jonas Bernoulli  writes:
>>
>>> In 2022 I changed Melpa to get ob-spice.el from
>>> https://repo.or.cz/ob-spice.git in response to
>>> https://github.com/melpa/melpa/issues/7872#issuecomment-1034945112.
>>
>> The last discussion was back in 2020 
>> https://list.orgmode.org/orgmode/cal1eyul8zzg-fdeedovbvm1cfc8w6ajwfr7cthvgs8owdwj...@mail.gmail.com/
>
> Bastien replied to that mentioning only one of the listed packages,
> which left me wondering "what about the others?".
>
>> However, your reference is 2022.
>> So, unless Christopher has something to say,
>> https://repo.or.cz/ob-spice.git is the last known active maintenance
>> location. The last commit is 2022
>> https://repo.or.cz/ob-spice.git/shortlog, and includes more changes
>> compared to ob-spice version in org-contrib.
>
> I came to the same conclusion but because ob-spice had not been removed
> from org-contrib, I wasn't sure.  Ihor, could you please remove it from
> org-contrib now?

I have already forget whether I taken the ob-spice maintaining task like
other libraries. So I'm not sure about it. I'm not work on this library
currently. From git log history, I'm the last maintainer. If you want to
maintain it or avoid duplicate, you can ask Bastien to remove it.

> Stardiviner, the readme in your repository still claims that the package
> is being maintained in two other locations.  Please remove that outdated
> information.
>

I have not found claimed two other locations in my README. Maybe I
missed out. Can you point out?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-04 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> With your patch, it will become impossible to display linked images
>>> using interactive command.
>>
>> Does this code match the needs?
>
> Please check my latest reply 
> (https://list.orgmode.org/87o7jpoqfl.fsf@localhost/T/#m25fbb254635512a7bf86d368bf93a24a1c2fb3f1).
> I think we may go away without introducing an extra defcustom.

After yesterday night studying source code, I still can't figure out
solution. So I pass this patch to you. Wait you to finish the unfinished
part of path.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-04 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> The problem here is backwards compatibility. `org-toggle-inline-images'
>>> is bound to C-c C-x C-v and people may be used to C-u C-c C-x C-v
>>> displaying linked images like
>>>
>>> [[https://orgmode.org/resources/img/org-mode-unicorn.svg][description]]
>>>
>>> I will need to think more how to approach this.
>>>
>>
>> Indeed.
>
> Another problem with your change is that the order of arguments changed.
> If there is some Elisp doing something like
> (org-toggle-inline-images INCLUDE-LINKED), your patch will break the
> code.
>
> I think that instead of changing the existing function, we can convert
> your patch into a new function `org-toggle-inline-images-command' that
> will be free to alter the argument order. We can then re-bind that
> function in org-keys to make it used by default, but only interactively.
>

I don't think so, the patch main purpose is for improve image refreshing
after babel result image displaying. Because the function is hooked by
other ob-* packages. Another purpose is headline level images displaying.
So modifying this function is the only way.

> As for displaying linked images, what about something like
>
>
> C-1 C-c C-x C-v being equivalent of
> C-c C-x C-v + INCLUDE-LINKED=t
> (display in current section/region, with linked)
>
> and
>
> C-11 C-c C-x C-v being equivalent of
> C-u C-u C-c C-x C-v + INCLUDE-LINKED=t
> (display in the whole buffer, with linked)
>

Don't know, I have not use it this way. I think INCLUDE-LINKED is just a
option argument for function org-display-inline-images. No need to be
available for toggle in interactive command. An option like
org-inline-images-include-linked is enough.

>> +(defun org-toggle-inline-images ( arg include-linked beg end)
>> +  "Toggle the display of inline images at point.
>> +INCLUDE-LINKED is passed to `org-display-inline-images'.
>> +
>> +If cursor is on an inline image link, display the inline image.
>> +If there is none, remove it otherwise.
>
> I do not quite understand what the last line is trying to say.

Emmm, I forget the meaning of it. I read the docstring again, seems it
can be deleted. I will delete it in my patch.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-02 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I think current patch is ready for merging now. WDYT?
>
> No, unfortunately.
> With your patch, it will become impossible to display linked images
> using interactive command.

Does this code match the needs?

#+begin_src emacs-lisp
   ;; [M-1] / [C-1] argument for linked images like:
   ;; [[https://orgmode.org/resources/img/org-mode-unicorn.svg][description]]
   ((equal arg 1)
(setq org-inline-images-include-linked (not 
org-inline-images-include-linked))
(let ((current-prefix-arg nil))
  (org-toggle-inline-images nil org-inline-images-include-linked)))
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-02 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I think current patch is ready for merging now. WDYT?
>
> No, unfortunately.
> With your patch, it will become impossible to display linked images
> using interactive command.

I still need time to study how to add support for this. Most likely I
can't implement it by myself. Would you modify my patch to add support
for this?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> This is not a toggle. This is unconditional refresh.
>>>
>> Yes, indeed it's a unconditional refresh. It does not match the meaning of 
>> word "toggle".
>>
>> Seems need to detect whether has image overlays in region. I added this
>> detection in new patch. Like bellowing:
>>
>> #+begin_src emacs-lisp
>> ...
>> ((use-region-p)
>> (if (seq-contains-p
>>  (mapcar
>>   (lambda (ov)
>> (plist-get (overlay-properties ov) 'org-image-overlay))
>>   (overlays-in beg end))
>>  t)
>
> You can just use `org--inline-image-overlays'.
>

Aha, I forget this API function, I applied in new patch.

>>> And there is no clean way to allow INCLUDE-LINKED while keeping
>>> consistency with latex preview commands.
>>
>> About the INCLUDE-LINKED argument, I don't know how to process it. In
>> theory, it should be handled by function org-display-inline-images
>> instead of org-toggle-inline-images. If you have improvements on it, can
>> you add code on my patch?
>
> The problem here is backwards compatibility. `org-toggle-inline-images'
> is bound to C-c C-x C-v and people may be used to C-u C-c C-x C-v
> displaying linked images like
>
> [[https://orgmode.org/resources/img/org-mode-unicorn.svg][description]]
>
> I will need to think more how to approach this.
>

Indeed.

>>> What we might do here is making a new defcustom that will control
>>> whether linked images should be displayed. Then, something like C-1
>>> org-toggle-inline-images could toggle that defcustom and refresh all the
>>> image previews in buffer (if any).
>>>
>>> WDYT?
>>
>> Refreshing all image previews in buffer is same as old behavior.
>
> Sure. But the idea of this specific C-1 prefix argument is to toggle the
> hypothetical defcustom `org-inline-images-include-linked'. If we flip it
> we may need to remove/add linked image previews or otherwise risk users
> being confused by the defcustom not taking effect.

I checked source code, don't know where to insert this functionality.
Is it be in `org-display-inline-images` or somewhere else?
I will find time to checking code whether can add this in another patch.
If you have plan for this, let me know.

I think current patch is ready for merging now. WDYT?

From 2f68f0172dc5e452c05a9d254eab8ae797bcd15b Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Mon, 22 May 2023 16:25:33 +0800
Subject: [PATCH] org: Improve inline images displaying like LaTeX previewing

* lisp/org.el (org-toggle-inline-images): Implement LaTeX previewing
same logic in inline images toggle displaying.
---
 lisp/org.el | 89 -
 1 file changed, 74 insertions(+), 15 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e72cf056a..04f713d26 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16160,22 +16160,81 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
   (when (memq ov org-inline-image-overlays)
 (push ov result)
 
-(defun org-toggle-inline-images ( include-linked beg end)
-  "Toggle the display of inline images.
-INCLUDE-LINKED is passed to `org-display-inline-images'."
+(defun org-toggle-inline-images ( arg include-linked beg end)
+  "Toggle the display of inline images at point.
+INCLUDE-LINKED is passed to `org-display-inline-images'.
+
+If cursor is on an inline image link, display the inline image.
+If there is none, remove it otherwise.
+If there is no inline image link at point, display all inline images in the current section.
+With an active region, display inline images in the region.
+
+With a `\\[universal-argument]' prefix argument ARG, clear inline
+images in the current section.
+
+With a `\\[universal-argument] \\[universal-argument]' prefix
+ argument ARG, display all inline images in the buffer.
+
+With a `\\[universal-argument] \\[universal-argument] \
+\\[universal-argument]' prefix argument ARG, clear all inline
+images in the buffer."
   (interactive "P")
-  (if (org--inline-image-overlays beg end)
-  (progn
-(org-remove-inline-images beg end)
-(when (called-interactively-p 'interactive)
-	  (message "Inline image display turned off")))
-(org-display-inline-images include-linked nil beg end)
-(when (called-interactively-p 'interactive)
-  (let ((new (org--inline-image-overlays beg end)))
-(message (if new
-		 (format "%d images displayed inline"
-			 (length new))
-		   "No images to display inline"))
+  (cond
+   ((not (display-graphic-p)) nil)
+   ;; Clear whole buffer inline images.
+   ((equal 

[PATCH v3] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-08-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> Unlike `org-latex-preview', here we need to (1) respect active region;
>>> (2) keep the backward compatibility for INCLUDE-LINKED.
>>>
>>> For (1), for example, it would make sense to respect region when prefix
>>> argument is C-u and clear images only there. For (2), we need to at
>>> least allow toggling images with description using some prefix argument
>>> (previously, any prefix argument would do).
>>
>> I indeed implemented all same behavior like `org-latex-preview' in new
>> `org-toggle-inline-images'.
>>
>> ...
>> And I also implement the toggle inline images in region logic in
>> `org-toggle-inline-images' as bellowing:
>>
>> ;; Display region selected inline images.
>>((use-region-p)
>> (message "Displaying inline images in region...")
>> (org-display-inline-images include-linked t (region-beginning) 
>> (region-end))
>> (message "Displaying inline images in region... done."))
>
> This is not a toggle. This is unconditional refresh.
>
Yes, indeed it's a unconditional refresh. It does not match the meaning of word 
"toggle".

Seems need to detect whether has image overlays in region. I added this
detection in new patch. Like bellowing:

#+begin_src emacs-lisp
...
((use-region-p)
(if (seq-contains-p
 (mapcar
  (lambda (ov)
(plist-get (overlay-properties ov) 'org-image-overlay))
  (overlays-in beg end))
 t)
(progn
  (org-remove-inline-images beg end)
  (message "Inline images in region removed."))
  (message "Displaying inline images in region...")
  (org-display-inline-images include-linked nil (region-beginning) 
(region-end))
  (message "Displaying inline images in region... done.")))

#+end_src

>> For (2), It's working. The code passed the parameter `include-linked' to
>> `org-display-inline-images'. So they works in any case of [C-u] prefix.
>
> My concern is that previously C-u M-x org-toggle-inline-images would
> "display links with a text description part". With your patch, it is no
> longer the case because INCLUDE-LINKED is not affected by the prefix
> argument.
>
> And there is no clean way to allow INCLUDE-LINKED while keeping
> consistency with latex preview commands.

About the INCLUDE-LINKED argument, I don't know how to process it. In
theory, it should be handled by function org-display-inline-images
instead of org-toggle-inline-images. If you have improvements on it, can
you add code on my patch?

>
> What we might do here is making a new defcustom that will control
> whether linked images should be displayed. Then, something like C-1
> org-toggle-inline-images could toggle that defcustom and refresh all the
> image previews in buffer (if any).
>
> WDYT?

Refreshing all image previews in buffer is same as old behavior. My
patch's purpose is to improve function org-toggle-inline-images behavior
which refresh only in current level scope instead of whole buffer with
lot of inline images especially heavy and suspend Emacs. Because
function org-toggle-inline-images is used in of lot Emacs ob-* related
packages on after babel execution hook. Old behavior caused execute one
source block need to refresh whole buffer all images. Instead of only
current headline images, or just results image.

From 635624cb8446791b9e39f2803077ac9fa6d17225 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Mon, 22 May 2023 16:25:33 +0800
Subject: [PATCH] org: Improve inline images displaying like LaTeX previewing

* lisp/org.el (org-toggle-inline-images): Implement LaTeX previewing
same logic in inline images toggle displaying.
---
 lisp/org.el | 92 -
 1 file changed, 77 insertions(+), 15 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e72cf056a..f847a42e7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16160,22 +16160,84 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
   (when (memq ov org-inline-image-overlays)
 (push ov result)
 
-(defun org-toggle-inline-images ( include-linked beg end)
-  "Toggle the display of inline images.
-INCLUDE-LINKED is passed to `org-display-inline-images'."
+(defun org-toggle-inline-images ( arg include-linked beg end)
+  "Toggle the display of inline images at point.
+INCLUDE-LINKED is passed to `org-display-inline-images'.
+
+If cursor is on an inline image link, display the inline image.
+If there is none, remove it otherwise.
+If there is no inline image link at point, display all inline images in the current section.
+With an active region, display inline images in the region.
+
+With

Re: Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs

2023-07-11 Thread M. Pger
Hi,

I understand better, thanks. Would be a good opportunity for me to (try to) 
contribute; this weekend I will check carefully the link you've sent. I'll keep 
you posted, your assistance would be more than welcome :)

Best,

MP




Sent with Proton Mail secure email.

--- Original Message ---
On Tuesday, July 11th, 2023 at 10:14 PM, Ihor Radchenko  
wrote:


> "M. Pger" mp...@protonmail.com writes:
> 
> > Sorry for the possibly silly question, but by '+1', can I understand that 
> > you will implement this feature because you think it is worth it?
> 
> 
> No, it just means that I think that this feature makes sense to be
> implemented. Basically, upvote.
> 
> Whether I am going to implement it myself depends on other users.
> 
> I usually do not put agenda features high in my todo list because
> org-agenda.el is a pain to work with due to obsolete code. But, I will
> re-consider if other people also say that they want this feature.
> 
> [ For context, I currently have 500 feature requests and ideas recorded in
> my notes. And there are also bugs and general maintenance tasks... I have
> to prioritize. ]
> 
> Or maybe someone motivated enough can try to implement it and submit a
> patch (see https://orgmode.org/worg/org-contribute.html). I will then
> provide assistance. (Helping new and returning contributors is certainly
> high in my todo list ;])
> 
> --
> 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: Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs

2023-07-11 Thread M. Pger
Hi,

Sorry for the possibly silly question, but by '+1', can I understand that you 
will implement this feature because you think it is worth it?

If this is case, thank you very much; if not, thank you anyway for your work 
with Org-mode!

Note that I was suggesting setting an upper bound, but being able to truncate 
breadcrumbs from both sides would be even nicer^^

Best,

MP

--- Original Message ---
On Tuesday, July 11th, 2023 at 11:30 AM, Ihor Radchenko  
wrote:


> "M. Pger" mp...@protonmail.com writes:
> 
> > Feature request: adjust ~org-agenda-format-item~ to let the user choose the 
> > first level included in breadcrumbs
> 
> 
> +1
> 
> --
> 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



Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs

2023-07-10 Thread M. Pger
Dear All,

Including "%b" in the org agenda prefix formats (org-agenda-prefix-format​) 
allows to display entries' outline paths, which is super useful to get 
project-oriented agenda views/todo-list.

Consider a project 'Foobar Report'. In the agenda view/todo-list, it would look 
like the following:
```
PROJECT Foobar Report
Foobar Report->TODO Task1
Foobar Report->Task1->TODO Subtask1.1
Foobar Report->Task1->TODO Subtask1.2
Foobar Report->TODO Task2
Foobar Report->Task2-> TODO Subtask2.1
Foobar Report->Task2-> TODO Subtask2.2
```

In such a setting, having 'Foobar Report' at the beginning of each line is not 
really useful and can impair readability. To tell Org to only print breadcrumbs 
starting at e.g. level 2 (i.e. skipping the 'Foobar Report' part of the 
breadcrumbs), I followed the first part of 
https://list.orgmode.org/CAGEgU=hgnxj7tsgv6pvdsewfwp_ivwe8wru+uh8hjh_7nnr...@mail.gmail.com/
 and modified the following part of org-agenda-format-item​:
```
(when org-prefix-has-breadcrumbs
(setq breadcrumbs
(org-with-point-at (org-get-at-bol 'org-marker)
(let ((s (org-format-outline-path (org-get-outline-path)
(1- (frame-width))
nil org-agenda-breadcrumbs-separator)))
(if (eq "" s) "" (concat s org-agenda-breadcrumbs-separator))
```
by replacing (org-get-outline-path) with
​```
(nthcdr (1- org-agenda-breadcrumbs-start-level)
(org-get-outline-path))

​```
while setting a custom variable org-agenda-breadcrumbs-start-level​ to 2. It 
works well.

Would the Org devs/active contributors be willing to implement such 
modification (maybe a cleaner version, with a better custom variable name?) in 
the next release of Org?

Best,

MP

PS: Note that I tried to implement the same using advice-add​, but miserably 
failed and decided to go for a complete redefinition of org-agenda-format-item 
(more lines, but less pain).

​

[PATCH v5] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-07-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I improved the code a little. Can't figure out how to implement upper logic.
>> Can you finish the last part? Thanks
>>
>> #+begin_src emacs-lisp
>> (setq tbl (let* ((tags-grouped (org-tag-alist-to-groups fulltable))
>>...
>
> I tried to improve the code readability in `org-fast-tag-selection'.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a19654583c6f2070096402bc712591a0a2c80d01
>
> May you look at it again and see if you can manage to implement a full
> patch now?

Ok, I update and re-generated the patch, also add new document and Org NEWS 
entries.

Review it, if has problem, notify me to modify. Thanks



0001-org-Improve-the-tags-fast-selection-performance.patch
Description: 

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SOLVED] Re: [QUESTION] Hope to improve the `org-set-font-lock-defaults` performance by lazy and limit to current visible area

2023-05-25 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I'm the developer of Org mode package "org-link-beautify"
>> https://repo.or.cz/org-link-beautify.git . The package main theory
>> is to use org-link-parameters `:activate-func` to do link file preview
>> with generating thumbnail images or file content etc.
>>
>> But I found it's slow one some big Org file and slow on small Org file
>> when previewing has a lot.
>> ...
>> I can see the `org-mode` invoked `org-set-font-lock-defaults` soon when
>> `org-mode` enabled. I hope the link `:activate-func` function can be
>> called only on link elements which is VISIBLE (means unfolded subtrees
>> or similar). So org-mode don't need to render all buffer links at
>> beginning soon. Instead render them as needed as unfolded. (Maybe I read
>> source code without fully understand the code. If so, correct me,
>> thanks.)
>
> Emacs fontification, by default, only requests fontification of the text
> visible on screen. That's what LIMIT argument to `font-lock-keywords'
> MATCHER function is for. Org mode obeys LIMIT.
>
> If you are seeing fontification being requested for invisible part of
> buffer or parts of buffer outside screen, it is likely caused by some
> third-party package forcing the fontification.
>
> As usual, try emacs -Q + minimal set of loaded packages and see if you
> can reproduce the problem.

Ihor, Thanks for answering. Learned new stuff.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[QUESTION] Hope to improve the `org-set-font-lock-defaults` performance by lazy and limit to current visible area

2023-05-24 Thread Christopher M. Miles

I'm the developer of Org mode package "org-link-beautify"
https://repo.or.cz/org-link-beautify.git . The package main theory
is to use org-link-parameters `:activate-func` to do link file preview
with generating thumbnail images or file content etc.

But I found it's slow one some big Org file and slow on small Org file
when previewing has a lot.

I locate and studied the source code of the `:activate-func`.

- [X] locate the core function source code
  + [X] org-link-set-parameters
- [X] org-link-parameters
  + [X] :activate-func
  + [X] org-mode major mode definition
+ [X] org-set-font-lock-defaults - Set font lock defaults for the current 
buffer.
  - [X] variable: org-font-lock-extra-keywords - dynamically scoped
+ [X] org-activate-links
  - [X] org-activate-links--text-properties
+ [X] :activate-func
  - [X] org-activate-links--overlays
+ [X] :activate-func

I can see the `org-mode` invoked `org-set-font-lock-defaults` soon when
`org-mode` enabled. I hope the link `:activate-func` function can be
called only on link elements which is VISIBLE (means unfolded subtrees
or similar). So org-mode don't need to render all buffer links at
beginning soon. Instead render them as needed as unfolded. (Maybe I read
source code without fully understand the code. If so, correct me,
thanks.)

So, I hope Org mode maintainer can improve this mechanism. Thanks a lot.

Hope this can improve other Org mode extensions performance too.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v4.1] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>>> (seq-take (seq-uniq (append bound-tags 
>>>> fulltable))
>>>>   org-fast-tag-selection-maximum-tags))
>>>
>>> This will behave awkwardly with tag groups. You may better use 
>>> `org--tag-add-to-alist'.
>>
>> I think here should use `append' instead of `org--tag-add-to-alist' to merge.
>
> Yeah. `org--tag-add-to-alist' does not tell it, but it actually prefers
> keeping duplicate tag copies from its second argument.
>
> Yet, however, tags with their binding assigned might occur inside a
> group. Your code will incorrectly pull them out.
>
> I think that the right approach to handle tag groups and explicitly
> bound tags is showing them all the time, even when the total number of
> tags exceeds the limit:
>
> 1. If a tag is bound explicitly (cdr non-nil) show it
> 2. If a tag is inside a group - show it
> 3. If there is still some room left, show up to the limit.
>
> My logic is that tag groups and bound tags can only be customized by the
> user. So, it makes sense to display them all the time - users likely
> expect such behaviour.
>
> WDYT?

I improved the code a little. Can't figure out how to implement upper logic.
Can you finish the last part? Thanks

#+begin_src emacs-lisp
(setq tbl (let* ((tags-grouped (org-tag-alist-to-groups fulltable))
 (fulltable-accurate (flatten-list 
(org-tag-alist-to-groups fulltable)))
 (bound-tags (seq-filter 'cdr fulltable)))
;; TODO: consider tag groups.
;; the right approach to handle tag groups and explicitly
;; bound tags is showing them all the time, even when the 
total number of
;; tags exceeds the limit
;; 
;; 1. If a tag is bound explicitly (cdr non-nil) show it
;; 2. If a tag is inside a group - show it
;; 3. If there is still some room left, show up to the 
limit.
(if (length< fulltable-accurate 
org-fast-tag-selection-maximum-tags)
fulltable
  (if (length< bound-tags 
org-fast-tag-selection-maximum-tags)
  (progn
(insert (format-message "Tags are limited displayed 
by `org-fast-tag-selection-maximum-tags'.\n"))
;; TODO:
(seq-take (seq-uniq (org--tag-add-to-alist 
bound-tags fulltable))
  org-fast-tag-selection-maximum-tags))
(insert "Tags are limited displayed only has key 
bound.\n")
bound-tags)))
  char ?a cnt 0)
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v4] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Updated version which fix the `message` error in upper code:
>
> Thanks!
>
>> #+begin_src emacs-lisp
>> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>> (if (length< fulltable 
>> org-fast-tag-selection-maximum-tags)
>
> Because of (:startgroup) markers and similar things, this condition is
> not fully accurate. See `org-tag-alist' docstring.
>
> You may also need to consider special alist items in the rest of the code.
>
I added a let-binding to modify fulltable at first to filter out special tag 
markers.

>> fulltable
>>   (if (length< bound-tags 
>> org-fast-tag-selection-maximum-tags)
>>   (progn
>> (insert "Tags are limited displayed by 
>> `org-fast-tag-selection-maximum-tags'.\n")
>
> If you want to have proper Elisp symbol markup when using `...', use
> `format-message'.

Updated.

>
>> (seq-take (seq-uniq (append bound-tags 
>> fulltable))
>>   org-fast-tag-selection-maximum-tags))
>
> This will behave awkwardly with tag groups. You may better use 
> `org--tag-add-to-alist'.

I think here should use `append' instead of `org--tag-add-to-alist' to merge.

Using `append':

#+begin_example
Inherited:  video
Current:

Tags are limited displayed by ‘org-fast-tag-selection-maximum-tags’.
  [d] drill   [z] crypt 
  [A] ARCHIVE 
  [E] noexport[P] private   
  [D] deprecated  
  [O] outdated[t] translate 
  [i] idea
  [h] book[b] bookmark  
  [w] work
  [a] appointment [m] meeting   
  [u] urgent  
  [X] SEX [k] wiki  
  [C] code
  [e] Emacs   [o] Org_mode  
  [G] git 
  [L] Linux   [M] macOS 
  [W] Windows 
  [l] LISP[c] Clojure   
  [s] ClojureScript   
  [J] Java[S] Shell 
  [p] Python  
  [r] Ruby[j] JavaScript
  [d] database
  [f] LOG [g] @marks
  [n] on  
  [q] off [v] star  
  [x] like
  [y] favorite[{] suggested 
  [|] heart   
  [}] smile   [~] brain 
  [ ] check   
  [ ] alert   [ ] important 
  [ ] flag
  [ ] error   [ ] label 
  
#+end_example

Using `org--tag-add-to-alist':

#+begin_example
Inherited:  video
Current:

Tags are limited displayed by ‘org-fast-tag-selection-maximum-tags’.
  [d] drill   [z] crypt 
  [f] LOG 
  [A] ARCHIVE [E] noexport  
  [P] private 
  [D] deprecated  [O] outdated  
  [g] @marks  
  [n] on  [q] off   
  [v] star
  [x] like[y] favorite  
  [{] suggested   
  [|] heart   [}] smile 
  [~] brain   
  [ ] check   [ ] alert 
  [ ] important   
  [ ] flag[ ] error 
  [ ] label   
  [ ] question[ ] info  
  [ ] quote   
  [ ] table  

Re: [PATCH v2] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-05-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> I'd prefer something more closely resembling `org-latex-preview'
>>> approach with prefix arguments:
>>> ...
>>> `org-toggle-inline-images' should also be changed.
>>
>> Here is the source code of `org-toggle-inline-images'. I implement this
>> by reference `org-latex-preview'. I have not write testing, but only
>> manually tested with Edebug and on actual Org buffer displaying and
>> disable inline images. The command works fine. Ihor, can you review the code?
>
> Unlike `org-latex-preview', here we need to (1) respect active region;
> (2) keep the backward compatibility for INCLUDE-LINKED.
>
> For (1), for example, it would make sense to respect region when prefix
> argument is C-u and clear images only there. For (2), we need to at
> least allow toggling images with description using some prefix argument
> (previously, any prefix argument would do).

I indeed implemented all same behavior like `org-latex-preview' in new
`org-toggle-inline-images'.

For (1), org-latex-preview has a `cond' logic to toggle preview in
region. Here is the code from `org-latex-preview'.

((use-region-p)
(message "Creating LaTeX previews in region...")
(org--latex-preview-region (region-beginning) (region-end))
(message "Creating LaTeX previews in region... done."))

+

;; Clear current section.
   ((equal arg '(4))
(org-clear-latex-preview
 (if (use-region-p)
 (region-beginning)
   (if (org-before-first-heading-p) (point-min)
 (save-excursion
   (org-with-limited-levels (org-back-to-heading t) (point)
 (if (use-region-p)
 (region-end)
   (org-with-limited-levels (org-entry-end-position)

And I also implement the toggle inline images in region logic in
`org-toggle-inline-images' as bellowing:

;; Display region selected inline images.
   ((use-region-p)
(message "Displaying inline images in region...")
(org-display-inline-images include-linked t (region-beginning) (region-end))
(message "Displaying inline images in region... done."))

+

;; Clear current section.
   ((equal arg '(4))
(org-clear-latex-preview
 (if (use-region-p)
 (region-beginning)
   (if (org-before-first-heading-p) (point-min)
 (save-excursion
   (org-with-limited-levels (org-back-to-heading t) (point)
 (if (use-region-p)
 (region-end)
   (org-with-limited-levels (org-entry-end-position)



For (2), It's working. The code passed the parameter `include-linked' to
`org-display-inline-images'. So they works in any case of [C-u] prefix.

Maybe you want to eval the patch code to test.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v4] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-16 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Updated version which fix the `message` error in upper code:
>
> Thanks!
>
>> #+begin_src emacs-lisp
>> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>> (if (length< fulltable 
>> org-fast-tag-selection-maximum-tags)
>
> Because of (:startgroup) markers and similar things, this condition is
> not fully accurate. See `org-tag-alist' docstring.
>
> You may also need to consider special alist items in the rest of the code.
>
I added a let-binding to modify fulltable at first to filter out special tag 
markers.

>> fulltable
>>   (if (length< bound-tags 
>> org-fast-tag-selection-maximum-tags)
>>   (progn
>> (insert "Tags are limited displayed by 
>> `org-fast-tag-selection-maximum-tags'.\n")
>
> If you want to have proper Elisp symbol markup when using `...', use
> `format-message'.

Updated.

>
>> (seq-take (seq-uniq (append bound-tags 
>> fulltable))
>>   org-fast-tag-selection-maximum-tags))
>
> This will behave awkwardly with tag groups. You may better use 
> `org--tag-add-to-alist'.

I think here should use `append' instead of `org--tag-add-to-alist' to merge.

Using `append':

#+begin_example
Inherited:  video
Current:

Tags are limited displayed by ‘org-fast-tag-selection-maximum-tags’.
  [d] drill   [z] crypt 
  [A] ARCHIVE 
  [E] noexport[P] private   
  [D] deprecated  
  [O] outdated[t] translate 
  [i] idea
  [h] book[b] bookmark  
  [w] work
  [a] appointment [m] meeting   
  [u] urgent  
  [X] SEX [k] wiki  
  [C] code
  [e] Emacs   [o] Org_mode  
  [G] git 
  [L] Linux   [M] macOS 
  [W] Windows 
  [l] LISP[c] Clojure   
  [s] ClojureScript   
  [J] Java[S] Shell 
  [p] Python  
  [r] Ruby[j] JavaScript
  [d] database
  [f] LOG [g] @marks
  [n] on  
  [q] off [v] star  
  [x] like
  [y] favorite[{] suggested 
  [|] heart   
  [}] smile   [~] brain 
  [ ] check   
  [ ] alert   [ ] important 
  [ ] flag
  [ ] error   [ ] label 
  
#+end_example

Using `org--tag-add-to-alist':

#+begin_example
Inherited:  video
Current:

Tags are limited displayed by ‘org-fast-tag-selection-maximum-tags’.
  [d] drill   [z] crypt 
  [f] LOG 
  [A] ARCHIVE [E] noexport  
  [P] private 
  [D] deprecated  [O] outdated  
  [g] @marks  
  [n] on  [q] off   
  [v] star
  [x] like[y] favorite  
  [{] suggested   
  [|] heart   [}] smile 
  [~] brain   
  [ ] check   [ ] alert 
  [ ] important   
  [ ] flag[ ] error 
  [ ] label   
  [ ] question[ ] info  
  [ ] quote   
  [ ] table  

[PATCH v3.1] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-15 Thread Christopher M. Miles

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> Ihor Radchenko  writes:
>
>> "Christopher M. Miles"  writes:
>>
>>>> You are almost there.
>>>> Just run your code only when (lentgh> fulltable 26).
>>>>
>>>> Of course, 26 should be a defcustom rather than a hard-coded constant.
>>>> And do the same for `org-fast-todo-selection'.
>>>
>>> Ok, I added defcustom option, and add cl-case condition on custom option
>>> `org-use-fast-tag-selection'.
>>
>> I do not think that we need to care about the value of
>> `org-use-fast-tag-selection'.  Instead, just
>>
>> 1. If the total number of tags does not exceed
>>`org-fast-tag-selection-maximum-tags', display them all.
>> 2. If the total number of tags is larger, just display all the bound
>>tags + any extra tags, up to `org-fast-tag-selection-maximum-tags',
>>and add a note in the tag selection buffer that more tags are not
>>displayed.
>
> Ok, I re-implemented the mechanism like bellowing, can you check whether it 
> fits?
>
> #+begin_src emacs-lisp
> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
> (if (length< fulltable 
> org-fast-tag-selection-maximum-tags)
> fulltable
>   (if (length< bound-tags 
> org-fast-tag-selection-maximum-tags)
>   (progn
> (seq-take (seq-uniq (append bound-tags fulltable))
>   org-fast-tag-selection-maximum-tags)
> (message "Tags are limited displayed by 
> `org-fast-tag-selection-maximum-tags'."))
> bound-tags
> (message "Tags are limited displayed only has key 
> bound."
>   char ?a cnt 0)
> #+end_src

Updated version which fix the `message` error in upper code:

#+begin_src emacs-lisp
(setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
(if (length< fulltable org-fast-tag-selection-maximum-tags)
fulltable
  (if (length< bound-tags 
org-fast-tag-selection-maximum-tags)
  (progn
(insert "Tags are limited displayed by 
`org-fast-tag-selection-maximum-tags'.\n")
(seq-take (seq-uniq (append bound-tags fulltable))
  org-fast-tag-selection-maximum-tags))
(insert "Tags are limited displayed only has key 
bound.\n")
bound-tags)))
  char ?a cnt 0)
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-05-15 Thread Christopher M. Miles

No objection

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v3] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-15 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> You are almost there.
>>> Just run your code only when (lentgh> fulltable 26).
>>>
>>> Of course, 26 should be a defcustom rather than a hard-coded constant.
>>> And do the same for `org-fast-todo-selection'.
>>
>> Ok, I added defcustom option, and add cl-case condition on custom option
>> `org-use-fast-tag-selection'.
>
> I do not think that we need to care about the value of
> `org-use-fast-tag-selection'.  Instead, just
>
> 1. If the total number of tags does not exceed
>`org-fast-tag-selection-maximum-tags', display them all.
> 2. If the total number of tags is larger, just display all the bound
>tags + any extra tags, up to `org-fast-tag-selection-maximum-tags',
>and add a note in the tag selection buffer that more tags are not
>displayed.

Ok, I re-implemented the mechanism like bellowing, can you check whether it 
fits?

#+begin_src emacs-lisp
(setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
(if (length< fulltable org-fast-tag-selection-maximum-tags)
fulltable
  (if (length< bound-tags 
org-fast-tag-selection-maximum-tags)
  (progn
(seq-take (seq-uniq (append bound-tags fulltable))
  org-fast-tag-selection-maximum-tags)
(message "Tags are limited displayed by 
`org-fast-tag-selection-maximum-tags'."))
bound-tags
(message "Tags are limited displayed only has key 
bound."
  char ?a cnt 0)
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-05-15 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> The `org-redisplay-inline-images' will refresh whole buffer inline
>> images. When the buffer is a big Org file, and not all inline images are
>> display already by default (still image file links under fold status).
>> Invoking `org-redisplay-inline-images' will cause Emacs suspend a long
>> time.
>>
>> So I suggest to add an variant local function of
>> `org-redisplay-inline-images' which named
>> `org-redisplay-inline-images-under-headline' that only redisplay inline
>> images under current headline to solve the issue.
>>
>> Here is the diff code prototype, Ihor, can you review it? If it's ok, I
>> will send patch update then.
>
> I'd prefer something more closely resembling `org-latex-preview'
> approach with prefix arguments:
>
> Toggle preview of the LaTeX fragment at point.
> 
> If the cursor is on a LaTeX fragment, create the image and
> overlay it over the source code, if there is none.  Remove it
> otherwise.  If there is no fragment at point, display images for
> all fragments in the current section.  With an active region,
> display images for all fragments in the region.
> 
> With a C-u prefix argument ARG, clear images for all fragments
> in the current section.
> 
> With a C-u C-u prefix argument ARG, display image for all
> fragments in the buffer.
> 
> With a C-u C-u C-u prefix argument ARG, clear image for all
> fragments in the buffer.
>
> `org-toggle-inline-images' should also be changed.

I agree this solution. I will check out latex fragment preview source
code whether I can implement this.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v2] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-05-15 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> The `org-redisplay-inline-images' will refresh whole buffer inline
>> images. When the buffer is a big Org file, and not all inline images are
>> display already by default (still image file links under fold status).
>> Invoking `org-redisplay-inline-images' will cause Emacs suspend a long
>> time.
>>
>> So I suggest to add an variant local function of
>> `org-redisplay-inline-images' which named
>> `org-redisplay-inline-images-under-headline' that only redisplay inline
>> images under current headline to solve the issue.
>>
>> Here is the diff code prototype, Ihor, can you review it? If it's ok, I
>> will send patch update then.
>
> I'd prefer something more closely resembling `org-latex-preview'
> approach with prefix arguments:
>
> Toggle preview of the LaTeX fragment at point.
> 
> If the cursor is on a LaTeX fragment, create the image and
> overlay it over the source code, if there is none.  Remove it
> otherwise.  If there is no fragment at point, display images for
> all fragments in the current section.  With an active region,
> display images for all fragments in the region.
> 
> With a C-u prefix argument ARG, clear images for all fragments
> in the current section.
> 
> With a C-u C-u prefix argument ARG, display image for all
> fragments in the buffer.
> 
> With a C-u C-u C-u prefix argument ARG, clear image for all
> fragments in the buffer.
>
> `org-toggle-inline-images' should also be changed.

Here is the source code of `org-toggle-inline-images'. I implement this
by reference `org-latex-preview'. I have not write testing, but only
manually tested with Edebug and on actual Org buffer displaying and
disable inline images. The command works fine. Ihor, can you review the code?

#+begin_src emacs-lisp
(defun org-toggle-inline-images ( arg include-linked beg end)
  "Toggle the display of inline images at point.
INCLUDE-LINKED is passed to `org-display-inline-images'.

If cursor is on an inline image link, display the inline image.
If there is none, remove it otherwise.
If there is no inline image link at point, display all inline images in the 
current section.
With an active region, display inline images in the region.

With a `\\[universal-argument]' prefix argument ARG, clear inline
images in the current section.

With a `\\[universal-argument] \\[universal-argument]' prefix
 argument ARG, display all inline images in the buffer.

With a `\\[universal-argument] \\[universal-argument] \
\\[universal-argument]' prefix argument ARG, clear all inline
images in the buffer."
  (interactive "P")
  (cond
   ((not (display-graphic-p)) nil)
   ;; Clear whole buffer inline images.
   ((equal arg '(64))
(org-remove-inline-images (point-min) (point-max))
(message "Inline images preview disabled in buffer."))
   ;; Display whole buffer inline images.
   ((equal arg '(16))
(message "Displaying all inline images in buffer...")
(org-display-inline-images include-linked nil (point-min) (point-max))
(message "Displaying all inline images in buffer... done."))
   ;; Clear current section.
   ((equal arg '(4))
(let* ((beg (if (use-region-p)
(region-beginning)
  (if (org-before-first-heading-p) (point-min)
(save-excursion
  (org-with-limited-levels (org-back-to-heading t) 
(point))
   (end (if (use-region-p)
(region-end)
  (org-with-limited-levels (org-entry-end-position
   (inline-images (org--inline-image-overlays beg end)))
  (org-remove-inline-images beg end)
  (message "%d inline images display removed." (length inline-images
   ;; Display region selected inline images.
   ((use-region-p)
(message "Displaying inline images in region...")
(org-display-inline-images include-linked t (region-beginning) (region-end))
(message "Displaying inline images in region... done."))
   ;; Toggle display of inline image link at point.
   ((let ((context (org-element-context)))
  (and (memq (org-element-type context) '(link))
   (let ((beg (org-element-property :begin context))
 (end (org-element-property :end context)))
 (if (org--inline-image-overlays beg end)
 (progn
   (org-remove-inline-images beg end)
   (message "Display inline image at point removed."))
   (org-display-inline-images include-linked t beg end)
   (message "Displaying inline image at point ... done."))
 t
   ;; Display inline images under current section.
 

Re: [PATCH v2] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-15 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> You are almost there.
>>> Just run your code only when (lentgh> fulltable 26).
>>>
>>> Of course, 26 should be a defcustom rather than a hard-coded constant.
>>> And do the same for `org-fast-todo-selection'.
>>
>> Ok, I added defcustom option, and add cl-case condition on custom option
>> `org-use-fast-tag-selection'.
>
> I do not think that we need to care about the value of
> `org-use-fast-tag-selection'.  Instead, just
>
> 1. If the total number of tags does not exceed
>`org-fast-tag-selection-maximum-tags', display them all.
> 2. If the total number of tags is larger, just display all the bound
>tags + any extra tags, up to `org-fast-tag-selection-maximum-tags',
>and add a note in the tag selection buffer that more tags are not
>displayed.

I think we should consider the option `org-use-fast-tag-selection'.
Because it controls the behavior that whether auto assign short-key to
tags. Make condition decision based on this option is needed. I hope you
can reconsider this.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH] add a function to only refresh inline images under current headline instead of global buffer

2023-05-14 Thread Christopher M. Miles

I found a lot of third-part Emacs packages refresh Org source block image 
result using the API function like this:

#+begin_src emacs-lisp
;; Automatically refresh inline images.
  (add-hook 'org-babel-after-execute-hook
(defun ob-dall-e--refresh-inline-images ()
  (when org-inline-image-overlays
(org-redisplay-inline-images
#+end_src

The `org-redisplay-inline-images' will refresh whole buffer inline
images. When the buffer is a big Org file, and not all inline images are
display already by default (still image file links under fold status).
Invoking `org-redisplay-inline-images' will cause Emacs suspend a long
time.

So I suggest to add an variant local function of
`org-redisplay-inline-images' which named
`org-redisplay-inline-images-under-headline' that only redisplay inline
images under current headline to solve the issue.

Here is the diff code prototype, Ihor, can you review it? If it's ok, I
will send patch update then.

#+begin_src diff
 (defun org-redisplay-inline-images ()
-  "Assure display of inline images and refresh them."
+  "Assure display of global all inline images in buffer and refresh them.
+
+NOTE: This function will refresh whole buffer inline images, if
+you only want to refresh inline images under headline, suggest to
+use `org-redisplay-inline-images-under-headline' in your hook or advice."
   (interactive)
   (org-toggle-inline-images)
   (unless org-inline-image-overlays
 (org-toggle-inline-images)))
 
+(defun org-redisplay-inline-images-under-headline ()
+  "Assure display of images under current headline and refresh them.
+This function is the suggested to be used in hook or advice."
+  (interactive)
+  (org-with-wide-buffer
+   (org-narrow-to-subtree)
+   ;; If has nested headlines, beg,end only from parent headline
+   ;; to first child headline which reference to upper
+   ;; let-binding `org-next-visible-heading'.
+   (org-display-inline-images
+nil nil
+(point-min) (progn (org-next-visible-heading 1) (point)
+
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH v2] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>>> #+begin_src emacs-lisp
>>>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>>>   (if (length> bound-tags 0)
>>>>   bound-tags
>>>> (seq-take temp-fulltable 26)))
>>>> #+end_src
>>>
>>> This will unconditionally drop auto-labeled tags when user-bound tags
>>> exist, even if the total number of tags in buffer does not exceed 26.
>>
>> I try to read the source code of `org-fast-tag-selection', but the code is 
>> hard to read.
>
> Yeah. I agree. But we have what we have.
>
>> I don't know how to keep auto-labeled tags. Do you have any suggestions?
>
> You are almost there.
> Just run your code only when (lentgh> fulltable 26).
>
> Of course, 26 should be a defcustom rather than a hard-coded constant.
> And do the same for `org-fast-todo-selection'.

Ok, I added defcustom option, and add cl-case condition on custom option
`org-use-fast-tag-selection'.



0001-org-Improve-the-tags-fast-selection-performance.patch
Description: 

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Sorry, wrong code, here is the correct code snippet:
>>
>> #+begin_src emacs-lisp
>> (let ((bound-tags (seq-filter 'cdr temp-fulltable)))
>>   (if (length> bound-tags 0)
>>   bound-tags
>> (seq-take temp-fulltable 26)))
>> #+end_src
>
> This will unconditionally drop auto-labeled tags when user-bound tags
> exist, even if the total number of tags in buffer does not exceed 26.

I try to read the source code of `org-fast-tag-selection', but the code is hard 
to read.
I don't know how to keep auto-labeled tags. Do you have any suggestions?


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-14 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> What about like this?
>>
>> #+begin_src emacs-lisp
>> (setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
>> (if (length> shortkeys 0)
>> bound-tags
>>   (seq-take fulltable 26)))
>>   char ?a cnt 0)
>> #+end_src
>
> What do you mean by "shortkeys"?

Sorry, wrong code, here is the correct code snippet:

#+begin_src emacs-lisp
(let ((bound-tags (seq-filter 'cdr temp-fulltable)))
  (if (length> bound-tags 0)
  bound-tags
(seq-take temp-fulltable 26)))
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> It would be great if you can come up with a patch.
>>> 1. Keeping tags with explicitly assigned key binding indeed makes sense
>>> 2. If we limit the number of displayed tags (on top of explicitly
>>>assigned), it should be a defcustom.
>>
>> Here is the patch.
>> -(setq tbl fulltable char ?a cnt 0)
>> +(setq tbl (seq-filter 'cdr fulltable) char ?a cnt 0)
>
> Thanks, but it will make the tag selection useless for people who did
> not customize explicit tag bindings.
>
> You should instead only filter when the number of tags exceeds some
> customized value.

What about like this?

#+begin_src emacs-lisp
(setq tbl (let ((bound-tags (seq-filter 'cdr fulltable)))
(if (length> shortkeys 0)
bound-tags
  (seq-take fulltable 26)))
  char ?a cnt 0)
#+end_src

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH] Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I applied your diff with a testing. This indeed solved the performance
>> issue.
>> Will this be updated in Org-mode source code?
>> Also I come up with one thing, filter out tags which have shortcut
>> keybinding bound. Because user defined shortcut key defined tags are not
>> always on head of list.
>
> It would be great if you can come up with a patch.
> 1. Keeping tags with explicitly assigned key binding indeed makes sense
> 2. If we limit the number of displayed tags (on top of explicitly
>assigned), it should be a defcustom.

Here is the patch.



0001-org-Improve-the-tags-fast-selection-performance.patch
Description: 

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist`

2023-05-13 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I have a large `org-tag-alist` value that contains about ~7000 tags.
>> When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long time.
>
> Indeed. That's because `org-fast-tag-selection' tries to put all those
> 7k tags into tag selection window.
>
> We can probably limit the maximum number of tags in the quick selection
> window.
>
> Can you try the attached simple diff for `org-fast-tag-selection' and
> check if it is enough to solve the hang?
>
> diff --git a/lisp/org.el b/lisp/org.el
> index c148409d9..d745fd01e 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -11765,7 +11765,7 @@ (defun org-fast-tag-selection (current inherited 
> table  todo-table)
>   (org-fast-tag-insert "Current" current c-face "\n\n")
>   (org-fast-tag-show-exit exit-after-next)
>   (org-set-current-tags-overlay current ov-prefix)
> - (setq tbl fulltable char ?a cnt 0)
> + (setq tbl (seq-take fulltable 26) char ?a cnt 0)
>   (while (setq e (pop tbl))
> (cond
>  ((eq (car e) :startgroup)

I applied your diff with a testing. This indeed solved the performance issue.
Will this be updated in Org-mode source code?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: BUG: org-cycle does not unfold some subtrees

2023-05-06 Thread Christopher M. Miles

I got similar result:


#+begin_example
Text content at position 33755:


There is an overlay here:
 From 33755 to 36387
  evaporatet
  invisibleorg-fold-outline
  isearch-open-invisible delete-overlay
  org-invisibleorg-fold-outline
  priority 5


There are text properties here:
  face org-level-2
  fontifiedt
  isearch-open-invisible org-fold-core--isearch-show
  isearch-open-invisible-temporary org-fold-core--isearch-show-temporary
  jinx--pendingt

#+end_example

#+begin_example
Text content at position 36387:


There are text properties here:
  fontifiedt
  isearch-open-invisible org-fold-core--isearch-show
  isearch-open-invisible-temporary org-fold-core--isearch-show-temporary

#+end_example

I confirmed I have NOT set `org-fold-core-style` to 'overlay.

Seems I have same reason with Michael.

Michael Dauer  writes:

> Got another observation:
> Text content at position 30248:
>
> There is an overlay here:
>  From 30248 to 30442
>   evaporatet
>   invisibleorg-fold-outline
>   isearch-open-invisible delete-overlay
>   org-invisibleorg-fold-outline
>   priority 5
>
> There are text properties here:
>   fontifiedt
>   isearch-open-invisible org-fold-core--isearch-show
>   isearch-open-invisible-temporary org-fold-core--isearch-show-temporary
>
> Am Sa., 6. Mai 2023 um 08:24 Uhr schrieb Ihor Radchenko :
>
>  "Christopher M. Miles"  writes:
>
>  > I meet an unfold-able headline now. Then I record a video to show this
>  > unfold-able headline. I executed command "describe-text-properties".
>
>  Please put the cursor right before the fold ("..."), execute M-x
>  describe-text-properties and share the properties description text.
>  You don't need video to share the property details buffer contents.
>
>  -- 
>  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>


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: BUG: org-cycle does not unfold some subtrees

2023-05-06 Thread Christopher M. Miles

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> I meet an unfold-able headline now. Then I record a video to show this
> unfold-able headline. I executed command "describe-text-properties".
> Afterwards, I closed the buffer, then re-open the file to show the
> headline can be expanded normally, and show the subtree content.
>
> Here is the uploaded video (P.S, I know video link is not a good way to
> archive information in mailing list, but this problem seems can't be
> text-described simply. Sorry about this.):
>
> https://upload.disroot.org/r/QNhW1xz0#X2or/2T7i7Kb7pHPxfAupRaEYJ28Sbp+2R6UDREnFic=

I recorded a new video which contains the Edebug process. Which shows
the `org-cycle' function internal status data. Ihor, hope this can help
you find the reason.

https://upload.disroot.org/r/khVnJgYV#vMBC3hiBUoPqBG2bgTEfJb44AUrGXVDuvpVGKv8Vw+w=

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[FEATURE Request] inherit headline directory for `org-attach' in `org-add-note' etc temp buffers

2023-05-05 Thread Christopher M. Miles

For example, I have Org content like this:

#+begin_src org
,* TODO Refrigerator
DEADLINE: <2023-04-06 Thu>
:PROPERTIES:
:ID:   e1824d15-35cb-4105-a617-5f7ecd6a1049
:END:
#+end_src

I press [C-c C-z] `org-add-note` to add logbook note. It will open a new
temporary buffer. I want to execute command [C-c C-a m] `org-attach-mv`
to attach a file. But it will prompt me for org-attach directory. I
think commands like `org-add-note`, `org-clock` add log, `org-todo`
change TODO state add log, etc should auto inherit this org-attach
directory. So that user can do `org-attach` in the temporary log buffer.

WDYT?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: BUG: org-cycle does not unfold some subtrees

2023-05-05 Thread Christopher M. Miles

I meet an unfold-able headline now. Then I record a video to show this
unfold-able headline. I executed command "describe-text-properties".
Afterwards, I closed the buffer, then re-open the file to show the
headline can be expanded normally, and show the subtree content.

Here is the uploaded video (P.S, I know video link is not a good way to
archive information in mailing list, but this problem seems can't be
text-described simply. Sorry about this.):

https://upload.disroot.org/r/QNhW1xz0#X2or/2T7i7Kb7pHPxfAupRaEYJ28Sbp+2R6UDREnFic=

Ihor Radchenko  writes:

> Michael Dauer  writes:
>
>> This is with the cursor on the first asterisk:
>> Text content at position 299:
>>
>>
>> There are text properties here:
>>   display  [Show]
>>   face org-level-1
>>   fontifiedt
>
> Well. This shows nothing.
> I am more interested in text properties at the fold.
>
>> I could not test more positions because I accidentally cut it, and even an
>> undo fixed it. I would have to wait until it happens again.
>
> Sure. Let me know when you are able to get more info.


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: BUG: org-cycle does not unfold some subtrees

2023-05-05 Thread Christopher M. Miles

Michael Dauer  writes:

> Maybe I missed a known bug when doing the research. But all the other reports 
> describe different and
> reproducible behaviour.
>
> Sometimes (often) I cannot unfold a subtree. It then affects only one or more 
> subtrees while others in the
> same buffer or even the same branch still work. The only fix then is to 
> either cut and paste the affected
> branches, or to close and reopen the file.
>
> While quite frequent I have not achieved to reproduce the issue. It just 
> happens after a while of using
> multiple files navigating with search, tab from agenda, org-refile, and cycle.
>
> Based on my analyses it's not the cycle functions, but must come from broken 
> text attributes. Even
> (org-fold-core-region (point-min) (point-max) nil) does not unfold the 
> affected subtrees then. Assuming
> that (org-fold-core-region) is the only place where the folding and hiding 
> happens, I expect the problem
> there. But I understand too little about the emacs internals to debug this 
> function.
>
> I hope this helps to fix the issue.
>
> Org mode version 9.7-pre (release_9.6.4-327-gf81ba4

I got same problem many times. Usually I close buffer and re-open file again.
I can confirm this issue. I will provides some info help here too.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-05 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> - [X] Then I check out Emacs source code file "epg.el" & "epa.el" file
>>   git log. -> have not found obvious gpg command-line options related to
>>   the problem. One small possible commit might be
>>   "82388dff8ed006cecb65ea7a4afd8667ec44b5e3".
>
> One of the reddit comments mentioned that the newer gpg hangs when not
> provided input. If this is true, I notice that `epg-start-encrypt' first
> calls (epg-wait-for-status context '("BEGIN_SIGNING")) and only then
> sends the buffer string for encryption (process-send-string).

In order to connect this mail list thread with the Emacs bug report.
Put bug report link here:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63256

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-05 Thread Christopher M. Miles

Ihor Radchenko  writes:

> Some more info: 
> https://old.reddit.com/r/emacs/comments/137r7j7/gnupg_241_encryption_issues_with_emacs_orgmode/

Indeed same problem as mine. Thanks Ihor

- [X] *downgrade* GnuPG from 2.4.1 -> 2.4.0 temporary get around the problem.

  #+begin_src sh
  brew info gnupg | grep "From:" | cut -d " " -f 2
  #+end_src

  #+RESULTS[(2023-05-05 14:19:54) 0e3dbbad14b66a4f05d2d70fb5cfd59db46f49bc]:
  : https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gnupg.rb

  #+begin_src sh
  
URL=https://raw.githubusercontent.com/Homebrew/homebrew-core/59edfe598541186430d49cc34f42671e849e2fc9/Formula/gnupg.rb
  wget $URL
  brew uninstall gnupg
  brew install -s gnupg.rb
  #+end_src

- [X] Check out GnuPG homepage changelog, Found new feature "ADSK: The 
Additional Decryption Subkey" for the problem gnupg version "2.4.1".
  After I executed bellowing command, -->> I still has problem.
  https://www.gnupg.org/blog/20230321-adsk.html

  #+begin_src sh
  gpg -K --with-subkey-fingerprint stardiviner
  #+end_src

  #+RESULTS[(2023-05-05 14:44:34) bc8e7497ce39ff0a8ae3fc45c332d64685e8da46]:
  : sec   rsa2048 2015-01-31 [SC]
  :   F09F650D7D674819892591401B5DF1C95AE89AC3
  : uid   [ultimate] stardiviner (numbch...@gmail.com) 

  : uid   [ultimate] stardiviner (Christopher Miles) 

  : uid   [ultimate] [jpeg image of size 3384]
  : ssb   rsa2048 2015-01-31 [E]
  :   32A8581A6E137ABD26DA2F570251FA6886EB6B77
  : 

  #+begin_src sh
  gpg --quick-add-adsk F09F650D7D674819892591401B5DF1C95AE89AC3 
32A8581A6E137ABD26DA2F570251FA6886EB6B77
  #+end_src

- [X] Then I check out Emacs source code file "epg.el" & "epa.el" file
  git log. -> have not found obvious gpg command-line options related to
  the problem. One small possible commit might be
  "82388dff8ed006cecb65ea7a4afd8667ec44b5e3".

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [Uploaded Edebug video] Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-03 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> Ok, I upload on Disroot website:
>>
>> https://upload.disroot.org/r/7skmXw7a#zt0jISsPuV0f3LkY9aRyz77X3iAOyD3cuue1Fbi9zy0=
>
> So, the hang happens on `epg-wait-for-status'.
> So, again, may you try to run the exact command line (including absence
> of input file) manually in terminal?
>
> Basically, `epg-wait-for-status' is looking at the output of gpg,
> waiting for "[GNUPG:] BEGIN_ENCRYPTION" and never gets that status from
> gpg. AFAIU.

I executed bellowing command in terminal without input file. (I added
aside comment using marker "|<--")

#+begin_src sh :eval no
$ gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 
--pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433

[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
gpg: 1B5DF1C95AE89AC3: skipped: public key already present   |<-- gpg wait for 
input and stopped here.
[GNUPG:] BEGIN_ENCRYPTION|<-- followed your 
hints, I input "[GNUPG:] BEGIN_ENCRYPTION" manually here.
hello|<-- I input text 
manually here.
[GNUPG:] PROGRESS stdin ? 0 0 B  |<-- gpg start to 
encrypting

=9I'iz^z=Ⱥ*pD>n̯dCj.:wD"zCy
  8$|
xMIiEXM{q2]"k1vx_$xIc3^L!L' $_уp
 T%QC a^i
WۄSuڅk?#\T}7
QhkwvUI#>^xNg{
#v/jͽrW[q9,W'%ϽVZ53BJGm_0VL`*vgT}[eQA:amRs?+z}6A/"b(?QU5*>ɨWQD$ih@ep^9<~[=5https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-03 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>   GPG_AGENT_INFO is not set
>>   /opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes 
>> --enable-progress-filter --command-fd 0
>> --output /var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T/epg-outputxPZRrb 
>> --pinentry-mode
>> loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
>>   [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
>>   [GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
>>   [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
>>   #+end_example
>>
>> ...
>>   The encrypt command seems missing input file.
>
> Which is clearly wrong, AFAIU. I guess it is then time to report bug to
> Emacs? You may also try to find where the input file gets lost from the
> argument list.
>

Thanks for checking out, Ihor.

I tried to figure it out in the Edebug process, but don't know where
data is wrong. May you can check out my uploaded video.

I also will report bug to Emacs.

>> - [X] record screen record for edebug process (430M), then compress big 
>> recorded video (~170M).
>>
>>   I uploaded to here: https://file.io/5fvOAbW5DPi6
>
> No longer available.

I uploaded again, don't know why the file expired not available.

https://file.io/j17OelAJFVVi

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively

2023-05-03 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> So currently ob-shell.el is async sending command into session buffer
>> without waiting for command to be finished.
>>
>> I checked out the ob-shell.el source code. I suppose this is the core
>> part of the problem. From intuitive view, session async evaluation
>> indeed should not wait for command to be finished. But still feel a
>> little weird.
>
> The core of the problem is in how Emacs comint is sending multiline
> input. My earlier example with M-x shell also demonstrates what is
> penning. comint.el basically simulates user input verbatim, as if you
> typed the whole thing symbol by symbol, including newlines.
>
> And it makes total sense as long as you are actually typing things
> interactively in the comint buffer.
>
> ob-shell :session in this case gets a bit weird. On one hand, it
> faithfully simulates interactive session. On the other hand, it does not
> feel fully interactive from user perspective, as you send a bunch of
> commands together within a single source block.
>
> One way to avoid the situations like with mpv could be packing the whole
> code block into script and then sending that script to comint session
> buffer. But then people who would like to actually switch to that buffer
> and work with it manually will get confused about what is going on
> there. (see `org-babel-switch-to-session' and
> `org-babel-switch-to-session-with-code').
>> If this :stdin interesting idea works, maybe other similar ideas will too.
>>
>> For examples:
>>
>> - Wrap command "mpv" with a shell function which disable accepting 
>> interactive input.
>
> Is there such a function? For all possible POSIX shells?
>
>> - Setting shell or environment variable in :prolog for source block to 
>> preventing interactive input.
>
> Again, do you know how to do this?

I tested with bash and wrap mpv into a function. The :prolog way is not
working too. Seems those workaround tries can't get around the
essential problem. I'm too naive

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively

2023-05-03 Thread Christopher M. Miles

Ihor Radchenko  writes:

> Matt  writes:
>
>>  > Matt, maybe you have some ideas about this edge case?
>>
>> I have no other ideas within the current ob-shell implementation.  As for 
>> modifications, I have the following thoughts.
>>
>> First, how might we state the problem for this edge case?
>>
>> To me, it looks like, "How can the ob-shell :async option manage interactive 
>> input?" Do you agree
>> with this formulation? If not, how do you see it differently?
>
> It is not about :async per se. Rather about using :session.
>
> A simple reproducer is
>
> #+begin_src bash :session test
> mpv "/path/to/some/video"
> m_
> #+end_src
>
> Basically, when you send multiline command in comint buffer without
> waiting for each line to finish, the following line may be read by the
> running command if that command is interactive.
>
> It is similar to a situation when you run a normal terminal like
>
> $ mpv "..."
> 
> 
> $ m_ 
>

Indeed, this explaination give me more clear understanding of the problem.

So currently ob-shell.el is async sending command into session buffer
without waiting for command to be finished.

I checked out the ob-shell.el source code. I suppose this is the core
part of the problem. From intuitive view, session async evaluation
indeed should not wait for command to be finished. But still feel a
little weird.

#+begin_src emacs-lisp
(session; session evaluation
(if async
(progn
  (let ((uuid (org-id-uuid)))
(org-babel-comint-async-register
 session
 (current-buffer)
 "ob_comint_async_shell_\\(.+\\)_\\(.+\\)"
 'ob-shell-async-chunk-callback
 nil)
(org-babel-comint-async-delete-dangling-and-eval
session
  (insert (format ob-shell-async-indicator "start" uuid))
  (comint-send-input nil t)
  (insert (org-trim body))
  (comint-send-input nil t)
  (insert (format ob-shell-async-indicator "end" uuid))
  (comint-send-input nil t))
uuid))
  (mapconcat
   #'org-babel-sh-strip-weird-long-prompt
   (mapcar
#'org-trim
(butlast ; Remove eoe indicator
 (org-babel-comint-with-output
 (session org-babel-sh-eoe-output t body)
   (insert (org-trim body) "\n"
   org-babel-sh-eoe-indicator)
   (comint-send-input nil t))
 ;; Remove `org-babel-sh-eoe-indicator' output line.
 1))
   "\n")))
#+end_src

>> One thought is to update :async to work with the :stdin option so that
>> the block is run as a script. Currently, :stdin runs synchronously in
>> a separate shell. We might be able to grab the script's output and put
>> it into the session buffer. See how the following runs in a temporary
>> shell, regardless of the :session/:async options.
>
> Avoiding session altogether will indeed solve the problem, as :session
> is the place where the problem lies.
>
> Adding :stdin support is also an interesting idea, even out of scope of
> this discussion.

If this :stdin interesting idea works, maybe other similar ideas will too.

For examples:

- Wrap command "mpv" with a shell function which disable accepting interactive 
input.
- Setting shell or environment variable in :prolog for source block to 
preventing interactive input.

Anyway, glad to get more interesting ideas.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-03 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> Do you have any issues decrypting and encrypting files from command
>>> line? If no, what about from M-x shell? If yet no, what if you call gpg
>>> via `start-process'?
>>>
>>
>> - [X] test decrypt & encrypt in terminal with gpg command. -> works fine.
>>
>> - [X] test decrypt & encrypt in Emacs =[M-x shell]= with gpg command. -> 
>> works fine.
>> ...
>> - [X] test decrypt & encrypt in Emacs with ~start-process~ -> works fine
>
> Ok. The further step we can try is following what epg does.
> I am now looking into `epg--start' source code and I note
> `epg-debug' variable, which might provide some more info to think about.
> Also, note the `make-process' call in `epg--start' - you may try to run
> it manually, similar to `start-process' and check if it fails. (For me,
> :connection-type 'pipe part is a bit fishy - I recall there were some
> quirks related to it;
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44824 ... but it was the
> opposite to having 'pipe AFAIR).

Ok, I followed your suggestions, did following steps.

- [X] toggle option ~epg-debug~

  #+begin_src emacs-lisp
  (setq epg-debug t)
  #+end_src

  #+begin_example :file "*epg-debug*"
  GPG_AGENT_INFO is not set
  /opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter 
--command-fd 0 --output 
/var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T/epg-outputMMP3Zp 
--pinentry-mode loopback --decrypt -- 
/Users/stardiviner/.config/emacs/secrets/authinfo.gpg
  [GNUPG:] PROGRESS /Users/stardiviner/. ? 0 1204 B
  [GNUPG:] ENC_TO AEDA8A17BB08B786 1 0
  [GNUPG:] ENC_TO 0251FA6886EB6B77 1 0
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  [GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  [GNUPG:] DECRYPTION_KEY 32A8581A6E137ABD26DA2F570251FA6886EB6B77 
F09F650D7D674819892591401B5DF1C95AE89AC3 u
  [GNUPG:] NO_SECKEY AEDA8A17BB08B786
  [GNUPG:] BEGIN_DECRYPTION
  [GNUPG:] DECRYPTION_INFO 2 7 0
  [GNUPG:] PROGRESS /Users/stardiviner/. ? 1204 1204 B
  [GNUPG:] PLAINTEXT 62 1682998161 
  [GNUPG:] DECRYPTION_OKAY
  [GNUPG:] GOODMDC
  [GNUPG:] END_DECRYPTION
  GPG_AGENT_INFO is not set
  /opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter 
--command-fd 0 --output 
/var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T/epg-outputE3zoeh 
--pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  [GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  GPG_AGENT_INFO is not set
  /opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter 
--command-fd 0 --output 
/var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T/epg-outputxPZRrb 
--pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  [GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
  [GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
  #+end_example

- [X] test the debug output buffer printed full command in terminal. (remove 
=--output= option to see the output)

  #+begin_src sh :eval no
  gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 
--pinentry-mode loopback --decrypt -- 
/Users/stardiviner/.config/emacs/secrets/authinfo.gpg
  # after input password, it decrypted success
  #+end_src

  The encrypt command seems missing input file.

  #+begin_src sh :eval no
  gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 
--pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
  #+end_src

- [X] I look into ~epg--start~ source code. note the ~make-process~ call in 
~epg--start~ - you may try to
  run it manually, similar to ~start-process~ and check if it fails. (For me, 
~:connection-type 'pipe~
  part is a bit fishy.)

  #+begin_src emacs-lisp :eval no
  ;;; `epg-start-encrypt' -> `epg--start'
  (let ((context
 #s(epg-context :protocol OpenPGP :program "/opt/homebrew/bin/gpg" 
:home-directory nil :armor nil :textmode nil :include-certs nil 
:cipher-algorithm nil :digest-algorithm nil :compress-algorithm nil 
:passphrase-callback (epa-file-passphrase-callback-function . 
"/Users/stardiviner/.config/emacs/secrets/authinfo.gpg") :progress-callback 
(epa-progress-callback-function . "Encrypting 
/Users/stardiviner/.config/emacs/secrets/authinfo.gpg") :edit-callback nil 
:signers nil :sender nil :sig-notations nil :process nil :output-file 
"/var/folders/ym/f3v5_yk1

Re: [EasyPG (epa)] Emacs can't save modified encrypted file

2023-05-02 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I downgrade gnupg, then the problem solved. But the downgrade version is
>> very old (gnupg@2.4.1 -> gnupg@2.2.41). I suspend problem is somewhere
>> else, like Emacs interaction with GnuPG process.
>
> Do you have any issues decrypting and encrypting files from command
> line? If no, what about from M-x shell? If yet no, what if you call gpg
> via `start-process'?
>

- [X] test decrypt & encrypt in terminal with gpg command. -> works fine.

- [X] test decrypt & encrypt in Emacs =[M-x shell]= with gpg command. -> works 
fine.

  #+begin_example
  bash-5.2$ bash-5.2$ 
  bash-5.2$ pwd 
  /Users/stardiviner/.config/emacs/secrets
  bash-5.2$ gpg -d authinfo.gpg > authinfo 
  gpg: encrypted with rsa2048 key, ID 0251FA6886EB6B77, created 2015-01-31
"stardiviner (numbch...@gmail.com) "
  gpg: encrypted with rsa2048 key, ID AEDA8A17BB08B786, created 2012-03-02
"Christopher Miles (stardiviner, numbchild) "
  gpg: using "F09F650D7D674819892591401B5DF1C95AE89AC3" as default secret key 
for signing
  bash-5.2$ ls 
  accounts.json.gpg authinfoauthinfo.gpg
  bash-5.2$ 
  #+end_example

- [X] test decrypt & encrypt in Emacs with ~start-process~ -> works fine

  #+begin_src emacs-lisp :dir "~/.config/emacs/secrets/" :results output
  (let ((output-buffer "*gnupg-decrypt*"))
(pwd)
(when (get-buffer output-buffer)
  (with-current-buffer (get-buffer output-buffer)
(erase-buffer)))
(start-process
 "gnupg-testing"
 output-buffer
 "gpg"
 "--decrypt" "authinfo.gpg"
 ;; ">" "authinfo"
 )
(sleep-for 2)
(print
 (with-current-buffer (get-buffer output-buffer)
   (buffer-substring-no-properties (point-min) (point-max)
  #+end_src

>> 4. I press =[C-g]= to quit got following stacktrace:
>>
>> #+begin_example
>> Debugger entered--Lisp error: (quit)
>>   accept-process-output(# 1)
>
> This certainly looks like gpg itself is waiting for something and Emacs
> is waiting for gpg...
>
>> When I save modified "=~/.config/emacs/secrets/authinfo.gpg=", got prompt:
>>
>> #+begin_example
>> Untrusted key AEDA8A17BB08B786 Christopher Miles (stardiviner, numbchild) 
>> .  Use anyway? (y or n)
>> #+end_example
>
>> If I input "n" for prompt:
>>
>> #+begin_example
>> Debugger entered--Lisp error: (file-error "Opening output file" "Encrypt 
>> failed" "Unusable public key: B8C4B8E547C32433 (key not tru...")
>
> This reminds me of 
> https://orgmode.org/list/2023-01-22t18-32...@devnull.karl-voit.at
> CC-ing Karl as he might be interested to join this discussion.
>

His error indeed same with mine. I have read email and check my private
key. Here is my private key info:

Check out my private key info:

#+begin_src sh
# gpg -K
gpg --list-secret-keys --verbose --with-subkey-fingerprints
#+end_src

#+RESULTS[(2023-05-03 01:41:09) 80ae7b09060704481af2e01ae6f6086262d4a05c]:
#+begin_example
/Users/stardiviner/.gnupg/pubring.kbx
-
sec   rsa2048 2015-01-31 [SC]
  F09F650D7D674819892591401B5DF1C95AE89AC3
uid   [ultimate] stardiviner (numbch...@gmail.com) 
uid   [ultimate] stardiviner (Christopher Miles) 
uid   [ultimate] [jpeg image of size 3384]
ssb   rsa2048 2015-01-31 [E]
  32A8581A6E137ABD26DA2F570251FA6886EB6B77

#+end_example

>> - [X] find bellowing two key ID belongs where
>>
>> Untrusted key "AEDA8A17BB08B786" ---> fingerprint 
>> "0DEF7425E79FE2E0090B424BAEDA8A17BB08B786" --> my old key
>> ((invalid-recipient (reason . 10) (requested . "B8C4B8E547C32433"))) --> 
>> "F09F650D7D674819892591401B5DF1C95AE89AC3" --> my current new gnupg key
>>
>> Question: I don't know why my current gnupg key and old gnupg key are 
>> together.
>>
>> Here is my Emacs EasyPG (epa) config:
>>
>> #+begin_src emacs-lisp
>> (use-package epa
>>   ;; force Emacs to use its own internal password prompt instead of an 
>> external
>>   ;; pinentry program.
>>   :preface (setenv "GPG_AGENT_INFO" nil)
>
> I do not use this setting on my side and simply stick to gtk password
> prompt.
>

I check my pinentry on macOS. Found package "pinentry-mac" installed by
Homebrew. Then I use it as pinentry-program in "gpg-agent.conf" config file.

Then I tested by remove upper (setenv "GPG_AGENT_INFO" nil) line.
Restart Emacs still same problem.

Then I disable my "epa" config,

[CLOSED] [ANSWER] Re: a temporary workaround solution using another language like "python"

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I check out ob-screen, it indeed can be used in my situation, thanks for 
>> suggestion.
>
> Also, you can try --no-terminal cmd switch for mpv. It will suppress
> terminal interaction, AFAIU.

Indeed, this option solved the problem real neat.
I'm surprised by your knowledge and digging problem skill.
I have to say a big TANKS to you. THANKS, THANKS, THANKS. Hahaha

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> The current CPU report indeed not contains heavy org-crypt. Because my
>> epa get problem. When I edit a GnuPG encrypted "encrypt.org.gpg", it
>> suspend on epa waiting for process to finished. It never ends unless I
>> press [C-g] to quit it.
>
> Which looks like gpg tried to display password prompt is some awkward
> place (like in bash sub-process under Emacs) and is forever waiting for
> your input.
>
> I have (setenv "DISPLAY" ":0.0") in my init.el to let graphical
> dialogues know how to popup from under Emacs process.

I'm under macOS system. the result of (getenv "DISPLAY") is
"ssh-askpass". This is weird...

I will dig deeper about this issue, update here later.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> My first version property "EVAL" inline src block indeed don't using
>> :async and :session. It can play video file.
>>
>> But I found it will block [Tab] org-cycle expand headline. I don't want
>> Emacs to be suspended. So I added :async change.
>
> For my use case, I simply use C-c C-a o to open the attachment or put a
> file link inside and use C-c C-o on the heading.

Indeed, Usually, your suggestion keybinding should be enough. I
originally add this hook for auto play background music or video MV etc.
I might think another method to do this auto action. For example auto
find first media file link and auto open it when match one specific condition.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SOLUTION] a temporary workaround solution using another language like "python"

2023-05-01 Thread Christopher M. Miles

Max Nikulin  writes:

> On 01/05/2023 20:08, Christopher M. Miles wrote:
>> I use another language "python" to replace "sh" to play video now. It 
>> successes.
>> :EVAL: src_python{import os; video_file = "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4";
>> os.system("mpv \"%s\" " %(video_file))}
>> It's not as convenient as shell command directly but at least it works.
>> Seems the sh inline source block can't be used to play video using "mpv"
>> (I also tested other video player commands like "mplayer", "iina" etc).
>
> For interactive application you may try ob-screen. I find its name confusing.

I check out ob-screen, it indeed can be used in my situation, thanks for 
suggestion.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I might consider to use another language like python instead of sh to
>> execute command to play video to get around this issue. I will update
>> here if I success.
>
> All you need to do is getting rid of :async and :session.
> Just use :results none + "&" at the end of mpv command.
> Non-session blocks will not suffer from this problem.

My first version property "EVAL" inline src block indeed don't using
:async and :session. It can play video file.

But I found it will block [Tab] org-cycle expand headline. I don't want
Emacs to be suspended. So I added :async change.

Now I use python `os.system()` to invoke shell command works fine.

Here is my current version:

(defcustom org-property-eval-keyword "EVAL"
  "A property keyword for evaluate code."
  :type 'string
  :safe #'stringp
  :group 'org)

(add-to-list 'org-default-properties org-property-eval-keyword)

(defun org-property-eval-on-cycle-expand ( state)
  "Evaluate Org inline source block in property value on headline cycle expand."
  (when (memq state '(children subtree))
(if-let ((inline-src-block (org-entry-get nil org-property-eval-keyword 
nil)))
(with-temp-buffer
  (insert inline-src-block)
  (goto-char (point-min))
  (let* ((context (org-element-context))
 (lang (org-element-property :language context))
 (type (org-element-type context))
 (src-block-info (org-babel-get-src-block-info nil context)))
(when (eq type 'inline-src-block)
  (org-babel-execute-src-block
   nil src-block-info
   (pcase lang
 ("sh" `((:session . ,(make-temp-name " *ob-sh-inline-async 
(sh) ")) (:async . "yes") (:results . "silent")))
 ("shell" `((:session . ,(make-temp-name " *ob-sh-inline-async 
(shell) ")) (:async . "yes") (:results . "silent")))
 ("bash" `((:session . ,(make-temp-name " *ob-sh-inline-async 
(bash) ")) (:async . "yes") (:results . "silent")))
 ("zsh" `((:session . ,(make-temp-name " *ob-sh-inline-async 
(zsh) ")) (:async . "yes") (:results . "silent")))
 ("python" `((:session . ,(make-temp-name 
"ob-python-inline-async ")) (:async . "yes") (:results . "silent")))
 (_ '((:results . "none")))

(add-hook 'org-cycle-hook #'org-property-eval-on-cycle-expand)

(defvar org-property-eval-templates
  '("src_sh{mpg123 \"path/to/music.mp3\"}"
"src_python{import os; os.system(\"mpv 'path/to/video.mp4' \")}"))
(org-completing-read-property-construct-function "EVAL" 
org-property-eval-templates)
(add-to-list 'org-property-set-functions-alist '("EVAL" . 
org-completing-read-property_eval))

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>>>> May you elaborate what performance issues you are experiencing?
>>>>
>>>> My performance issue is a large Org file about 2M size on saving. I will
>>>> reproduce and generate profiler report for more detailed data and update
>>>> in this thread.
>>>
>>> Please save the report using M-x profiler-report-write-profile - it will
>>> produce Elisp data that can be re-opened and examined directly.
>>
>> I attached CPU and Memory report in attachments.
>
> This CPU report is not just for saving. You did M-x (vectico), `undo',
> `org-clock-in', and `save-buffer'. `save-buffer' took no time. And
> everything took less than one second.
>
> Are you sure that it is the correct profile?

The current CPU report indeed not contains heavy org-crypt. Because my
epa get problem. When I edit a GnuPG encrypted "encrypt.org.gpg", it
suspend on epa waiting for process to finished. It never ends unless I
press [C-g] to quit it. So I can't reproduce the Org file contains
org-crypt headlines saving profiler report.

Sorry that I have not mentioned this actual background reason. I indeed
did a profiler report before (about 3 months ago), and the profiler
report use lot of time on org-crypt invocation. Hmm, maybe problem gone
as time scrolls.

I will mark this as task in my Org Agenda, and take time to profiler
report again, make sure org-crypt is heavy, then update here.

Regards,

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SOLUTION] a temporary workaround solution using another language like "python"

2023-05-01 Thread Christopher M. Miles

I use another language "python" to replace "sh" to play video now. It successes.

Here is my example:

#+begin_src org
,* 《枕刀歌》
:PROPERTIES:
:DATE: [2021-05-13 Thu 20:09]
:Douban:   https://movie.douban.com/subject/35350794/
:DIR:  枕刀歌
:EVAL: src_python{import os; video_file = "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"; 
os.system("mpv \"%s\" " %(video_file))} 
:END:

#+end_src

It's not as convenient as shell command directly but at least it works.
Seems the sh inline source block can't be used to play video using "mpv"
(I also tested other video player commands like "mplayer", "iina" etc).

So this python solution is a workaround.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> So, it looks to me like mpv is somehow trying to interpret "echo" commands 
>>> the
>>> ob-shell is sending after "mpv " is executed:
>> ...
>> Don't know ob-shell which part did your said "echo" commands. I don't
>> know where to dig this issue. Hope you can help. Thanks for your
>> reproducing problem and dive in.
>
> The underlying issue lies within how comint works + the fact that mpv
> reads key input from terminal.
>
> Try the following:
>
> 1. emacs -Q
> 2. M-x shell
> 3. cd /path/to/your/video 
> 4. Copy the following into kill ring
> -
> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
> m_
> -
> 5. (in the shell buffer): C-y 
> 6. Observe mpv playing no sound and video
> 7. Press m_ to restore video and sound.
>

I reproduced same now. Thanks for your guide.

> I am not sure if we can do much about this though.
> We run async shell commands in sessions using
>
> (insert (format ob-shell-async-indicator "start" uuid))
> (comint-send-input nil t)
> (insert (org-trim body))
> (comint-send-input nil t)
> (insert (format ob-shell-async-indicator "end" uuid))
> (comint-send-input nil t)
>
> which sends
>
> "echo ''
> 
> echo '...'"
>
> to comint terminal session.
>
> The last echo '...' in this case is interpreted as key input by mpv -
> symbol by symbol.
>
> The only way I know how to work around this is a giant one-liner like
> echo ''; ; echo '...'
>

I understand the process now, it is wrapped by ob-shell-async-indicator echo 
command.

> However, (1) ";" may not work in some shells; (2)  may
> contain multiple lines, leading to the same issue.

I tested it (using ";") now, not working.

I might consider to use another language like python instead of sh to
execute command to play video to get around this issue. I will update
here if I success.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>> We should certainly not attempt decryption on  by default - it may
>>> be annoying when you actually do not want to decrypt anything, just
>>> look inside.
>>
>> You're right, I have not consider enough.
>
> Of course, you can still use `org-cycle-hook' if you want this behaviour
> in your personal setup.
>
>>> May you elaborate what performance issues you are experiencing?
>>
>> My performance issue is a large Org file about 2M size on saving. I will
>> reproduce and generate profiler report for more detailed data and update
>> in this thread.
>
> Please save the report using M-x profiler-report-write-profile - it will
> produce Elisp data that can be re-opened and examined directly.

I attached CPU and Memory report in attachments.



cpu.report
Description: CPU Report


memory.report
Description: Memory Report


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I'm also try to improve this file to improve large Org buffer saving 
>> performance.
>
> org-encrypt already caches the encrypted text and takes basically no
> time for the repeated encryption, as long the text to be encrypted is 
> unchanged.
>
>> I have some ideas:
>>
>> - auto encrypt buffer on buffer save hook (currently mechanism, your patch 
>> improved it)
>
> Sorry, but my patch has nothing to do with save hook. It only changes 
> decryption.
>
>> - auto decrypt on org-cycle expand headline if current headline is 
>> encrypted. e.g. on `org-cycle-hook`
>
> I am not sure how it has anything to do with performance.
> You can already use C-c C-r (or M-x org-reveal) to decrypt entry at
> point.
> We should certainly not attempt decryption on  by default - it may
> be annoying when you actually do not want to decrypt anything, just
> look inside.

You're right, I have not consider enough.

>
>> - auto encrypt ONLY current fold action on headline scope if has crypt key 
>> specified. e.g. on `org-cycle-hook`
>
> That might be possible, but I often do not want my encrypted
> sub-headings being encrypted while I re-structure and re-fold my file.
>
> May you elaborate what performance issues you are experiencing?

My performance issue is a large Org file about 2M size on saving. I will
reproduce and generate profiler report for more detailed data and update
in this thread.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>>> But I failed to execute mpv command:
>>>>
>>>> #+begin_src org
>>>> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
>>>> #+end_src
>>>
>>> May you elaborate what you mean by "failed"?
>>
>> The "failed" means the MPV video player window does not show up, no video, 
>> no audio.
>
> Interesting. I tried harder to reproduce following your steps.
> Now, I used a video file with CJK name:
>
> * 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  鸟瞰古
> :EVAL: src_sh{mpv "鸟瞰古/【人文纪录片】鸟瞰古代中国.Ancient.China.from.Above P1 
> 鸟瞰古代中国.Ancient.China.from.Above.S01flv"}
> :END:
>
> And I can reproduce - mpv windows shows up, but no video and no sound.
> Then, I tried to open the same video in usual way... and still no sound
> - until I press "m" to unmute.
>
> So, it looks to me like mpv is somehow trying to interpret "echo" commands the
> ob-shell is sending after "mpv " is executed:
>
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> ...
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> ...
> [input] No key binding found for key '''.
>
> These "No key binding found statements" a likely from "echo" commands
> attempted to be sent to the terminal.

Do you think this issue is from Emacs shell part or mpv part?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>>>> But I failed to execute mpv command:
>>>>
>>>> #+begin_src org
>>>> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
>>>> #+end_src
>>>
>>> May you elaborate what you mean by "failed"?
>>
>> The "failed" means the MPV video player window does not show up, no video, 
>> no audio.
>
> Interesting. I tried harder to reproduce following your steps.
> Now, I used a video file with CJK name:
>
> * 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  鸟瞰古
> :EVAL: src_sh{mpv "鸟瞰古/【人文纪录片】鸟瞰古代中国.Ancient.China.from.Above P1 
> 鸟瞰古代中国.Ancient.China.from.Above.S01flv"}
> :END:
>
> And I can reproduce - mpv windows shows up, but no video and no sound.
> Then, I tried to open the same video in usual way... and still no sound
> - until I press "m" to unmute.
>
> So, it looks to me like mpv is somehow trying to interpret "echo" commands the
> ob-shell is sending after "mpv " is executed:
>
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> ...
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> ...
> [input] No key binding found for key '''.
>
> These "No key binding found statements" a likely from "echo" commands
> attempted to be sent to the terminal.

I have similar output in session buffer too. Here is the output in my session 
buffer.

When I press Tab key to expand upper headline. I check the inline src block 
session buffer, here is the output:

#+begin_example
bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
org_babel_sh_prompt> echo 
'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
org_babel_sh_prompt> =[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key '''.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'y'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key '''.

Resuming playback. This behavior can be disabled with --no-resume-playback.

 Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [coreaudio] 48000Hz stereo 2ch floatp
Mute: yes



  C-c C-c>
Saving state.

Exiting... (Quit)
org_babel_sh_prompt> echo $SHELL 
/bin/zsh
org_babel_sh_prompt> 
#+end_example


I also try to add "sleep 1;" command before "mpv ..." command to delay
mpv executing. Still not success.

Don't know ob-shell which part did your said "echo" commands. I don't
know where to dig this issue. Hope you can help. Thanks for your
reproducing problem and dive in.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption

2023-04-30 Thread Christopher M. Miles

Thanks Ihor for improve this file.

I'm also try to improve this file to improve large Org buffer saving 
performance.

I have some ideas:

- auto encrypt buffer on buffer save hook (currently mechanism, your patch 
improved it)
- auto decrypt on org-cycle expand headline if current headline is encrypted. 
e.g. on `org-cycle-hook`
- auto encrypt ONLY current fold action on headline scope if has crypt key 
specified. e.g. on `org-cycle-hook`

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-30 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I have Emacs Org mode config like bellowing to auto evaluate inline src
>> block when Org headline cycle expanded.
>> ...
>> Here is the testing Org content:
>> ...
>>
>> When I press Tab key to expand upper headline. I check the inline src block
>> session buffer, here is the output:
>>
>> #+begin_example
>> bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
>> org_babel_sh_prompt> echo
>> 'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
>> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
>> echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
>> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
>> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
>> ...
>> Resuming playback. This behavior can be disabled with --no-resume-playback.
>>
>>  Video --vid=1 (*) (h264 1920x1080 25.000fps)
>>  (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
>> AO: [coreaudio] 48000Hz stereo 2ch floatp
>> Mute: yes
>>
>>
>>
>>   C-c C-c>
>> Saving state.
>>
>> Exiting... (Quit)
>> org_babel_sh_prompt> echo $SHELL
>> /bin/zsh
>> org_babel_sh_prompt>
>> #+end_example
>
> It looks like mpv command is running.
>

Yes, check out the output from the sh session buffer, we can confirm mpv is 
executed.
But seems got weird error.

>> ...
>> But I failed to execute mpv command:
>>
>> #+begin_src org
>> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
>> #+end_src
>
> May you elaborate what you mean by "failed"?

The "failed" means the MPV video player window does not show up, no video, no 
audio.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-30 Thread Christopher M. Miles

Ruijie Yu  writes:

> Try putting "cat" there.  I suspect something is fed into the stdin of
> the process.

Can you explain in detailed? Don't know how to put command "cat" in my 
situation.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Emacs and org mode in aws

2023-04-16 Thread Christopher M. Miles

Naresh Gurbuxani  writes:

> In my Amazon Web Service account, I can launch emacs from the terminal. 
> Nearly all emacs features
> work well. But I miss the ability to view graphs created by code blocks in 
> org mode. Have other
> members found a solution?
>

I don't know whether AWS supports SSH X11 Forwarding. But you can check
out this feature to get Linux desktop forwarding view as for Emacs
graphics.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SOLVED] Re: How to change working directory in ob-matlab source block?

2023-04-12 Thread Christopher M. Miles

stardiviner  writes:

> Is there friend know Emacs Org mode and Matlab here?
>
> I try to save Matlab plot into image file in another path instead of current 
> working directory. Like
> bellowing code:
>
> #+headers: :var cwd=(expand-file-name "data/images/" (file-name-directory 
> (buffer-file-name)))
> #+headers: :prologue "eval(sprintf("cd '%s'", cwd))"
> #+headers: :epilogue "saveas(gcf,'matlab-plot-demo2.png'); close(gcf);"
> #+begin_src matlab :results graphics file link :dir "data/images" :file 
> "matlab-plot-demo2.png" :session
> "*MATLAB*"
> bar([1 11 7 8 2 2 9 3 6])
> #+end_src
>
> #+RESULTS[(2023-04-13 00:09:01) c5fc0d36b27e75610664ee69ae618649637e45d9]:
> [[file:data/images/matlab-plot-demo2.png]]
>
> But Matlab command "cd" does not work correctly in upper code method.
>

I find out the solution. The "cd" command used as a function then pass
in path string as argument. It works fine. So I adopt source block like
this:

#+headers: :var cwd=(expand-file-name "data/images/" (file-name-directory 
(buffer-file-name)))
#+headers: :prologue "cd(cwd)"
#+begin_src matlab :session "*MATLAB*" :results output
% eval(sprintf("cd '%s'", cwd))
% eval(sprintf("cd('%s')", cwd))
% cd(cwd)

% returns the path to the current working directory.
pwd
#+end_src

#+RESULTS[(2023-04-13 13:20:27) 0c1259b084fc93f95d7c60c9c748a0630bf4391d]:
#+begin_example
cd(cwd)
cwd='/Users/stardiviner/Org/Wiki/Computer Technology/Programming/Emacs/Emacs 
Packages/Org mode/data/images/';
% eval(sprintf("cd '%s'", cwd))
% eval(sprintf("cd('%s')", cwd))
% cd(cwd)
% returns the path to the current working directory.
pwd

ans =

'/Users/stardiviner/Org/Wiki/Computer Technology/Programming/Emacs/Emacs 
Packages/Org mode/data/images'
#+end_example

Really tricky for me. Hope helpful for some user.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Remove "shell" as a supported Babel language within ob-shell.el

2023-03-24 Thread Christopher M. Miles

At first, thanks for this long parsing and explanation.

Matt  writes:

>  > Matt m...@excalamus.com> writes:
>  >
>  > > Is there a reason you're using "shell" instead of one of the shells 
> listed in `org-babel-shell-names'?
>
> I'm still curious why you're using "shell".  I want to know if it's something 
> you're using for a specific reason.  There's no wrong answer!
>
> I ask because I have an agenda: as far as I can tell, "shell" as a Babel 
> language is a historical accident.  
>
> #+begin_longwinded_explanation
> Originally, ob-shell.el was called ob-sh.el.  The main function was called 
> `org-babel-execute:sh' and only /usr/bin/env sh was supported.  Over time it 
> became clear that to support other shells, the "sh" name shouldn't be used 
> for the package or the main function.  That is, 'sh' refers to a specific 
> binary and, if other binaries such as bash, dash, csh, etc. were to be 
> supported, it would be misleading for the Babel language to refer to a 
> specific shell, 'sh'.  So, the terminology was changed to something more 
> general, "shell".  The package was renamed to "ob-shell.el", the "namespace" 
> updated to "shell" (for example, `org-babel-execute:shell'), and the package 
> load call changed from (sh . t) to (shell . t).  This officially happened 
> with Org 8.2 (ORG-NEWS noted the change in commit 
> 1a9adcb6d34bcbdff45445c827ed99dbf0b8, Tue Jan 21 09:52:31 2014).  I think 
> this gave people the (understandable) impression that "shell" was a valid 
> Babel language, in addition to those listed in `org-babel-shell-names'.  
>
> And this is where the accident happened: "shell" as a Babel language only 
> **happens**to work.  The Babel framework looks for a function prototype like 
> "org-babel-execute:".  When ob-sh.el was changed to ob-shell.el, 
> the function `org-babel-execute:sh' became `org-babel-execute:shell'.   A 
> call like follows is perfectly legal as far as the Babel framework is 
> concerned:
>
> #+begin_src shell
> echo "hello, world"
> #+end_src
>
> When such a block is run, Babel looks for a function called 
> `org-babel-execute:shell'. Running the
> block prior to Org 8.2 should have failed because no 
> `org-babel-execute:shell' function existed. The
> name change happened to source Fri Dec 13 09:52:05 2013 in commit
> 7a6c0e35415c4a173d101336029262f3a09abb91. After the name change, the function 
> existed and a block
> using "shell" would execute!

Yes, I originally use "sh" too. But at some time point, I saw an article
somewhere, then I switched to "shell". I forget the specific reason
already.

> The "shell" language specifier, as far as I can tell, was never really 
> intentionally supported.
> Instead, it just happened to work. It happened to work because, as far back 
> as the first
> org-babel-sh.el commit, the process buffer is created using the `shell' 
> function. I don't know the
> history of `shell', but presently the documentation says,
>
> Program used comes from variable ‘explicit-shell-file-name’,
>  or (if that is nil) from the ESHELL environment variable,
>  or (if that is nil) from ‘shell-file-name’.
>
> That is, the `shell' command falls back to `shell-file-name'. I assume that 
> `shell' has always had
> that, or a similar, fallback. The `shell-file-name' is a direct path to an 
> executable. This means
> that when "shell" is used for the language, `shell-file-name' is called and 
> **any** startup script,
> such as .bash_profile or .bashrc, is called. The prompt could be set to 
> **anything** and Emacs will
> never know, and can never know, what the prompt is without the user 
> explicitly informing Emacs.
>
> Aside from the code change which allowed "shell" to work, "official" support 
> of "shell" comes from
> Org manual commit 9d072ad67517875069f913315d762c9bb1e9c3ec, Sun Dec 17 
> 11:06:05 2017 (for example,
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/doc/org-manual.org?id=f7aa8c19f5170dbf09538686fb569f9b60acbd6c#n18410).
> This appears unconnected with the code change. The addition to the manual 
> happened 4 years after the
> code name change and none of the commit messages around the time of code 
> change suggest that "shell"
> was intended to work as a language. In fact, I found this email from Eric 
> Schulte (creator of Babel
> and maintainer at the time of the code change) which suggests that "shell" is 
> in fact not supported
> or intented as a language 
> (https://lists.gnu.org/archive/html/emacs-orgmode/2013-12/msg0

Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images)

2023-03-23 Thread Christopher M. Miles

This is an acceptable solution for large width image. I propose this RFC too.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] ob-shell async result output should not contains shell prompt

2023-03-23 Thread Christopher M. Miles

Matt  writes:

>   On Wed, 22 Mar 2023 23:25:50 -0400  Christopher M. Miles  wrote --- 
>  > 
>  > The ob-shell async result output contains the shell prompt. I think it
>  > should not be captured.
>  > 
>  > #+begin_src shell :session "test2" :async t
>  > sleep 30
>  > echo "hello, world"
>  > #+end_src
>  > 
>  > #+RESULTS[(2023-03-23 11:19:22) 461ed5de684f6e619890709175ec73e80b67b2d6]:
>  > : bash-5.2$ hello, world
>
> Thanks for reporting this.
>
> Try using for the babel language whatever shell the variable 
> `shell-file-name' gives.  For example, if `shell-file-name' is /bin/bash, do 
> this:
>
> #+begin_src bash :session "test2" :async t
> sleep 1
> echo "hello, world"
> #+end_src
>
> Is there a reason you're using "shell" instead of one of the shells listed in 
> `org-babel-shell-names'?

Using language identities like bellowing:

#+begin_src sh :session "*ob-shell*" :async t
sleep 30
echo "hello, world"
#+end_src

#+RESULTS[(2023-03-23 19:14:12) dd777a237986481833c08eb5eceac717576eddb7]:
: org_babel_sh_prompt> hello, world

#+begin_src bash :session "*ob-shell-bash*" :async t
sleep 30
echo "hello, world"
#+end_src

#+RESULTS[(2023-03-23 19:14:15) 23f9ad130f7a1268e21821c6baaea2b057c70d3e]:
: org_babel_sh_prompt> hello, world

#+begin_src zsh :session "*ob-shell-zsh*" :async t
sleep 30
echo "hello, world"
#+end_src

#+RESULTS[(2023-03-23 19:14:17) 2bb44d96c2e482a90c5a89bdde0b64d0319663a1]:
: % 

 
:  
: % 

 
:  
: hello, world
: % 

 
:  

Still got a prompt. Is this intended? I think the output should be kept clean 
because the result
output might be used as input for other source blocks as data.

Maybe error in my Org babel settings? Bellowing is my system and variable 
values:

#+begin_src emacs-lisp
system-type
#+end_src

#+RESULTS[(2023-03-23 19:27:13) 7df8395169a77d83cb6a5a6efc2223d412813efa]:
: darwin

#+begin_src emacs-lisp
shell-file-name
#+end_src

#+RESULTS[(2023-03-23 19:26:33) e6fed18a9a543dd6320385ee715d9ee68b464a04]:
: /opt/homebrew/bin/bash

#+begin_src emacs-lisp
org-babel-sh-prompt
#+end_src

#+RESULTS[(2023-03-23 19:30:12) f6efc29dba5be2171eba0a25abec19908fb1c6be]:
: org_babel_sh_prompt> 

#+begin_src emacs-lisp
org-babel-shell-names
#+end_src

#+RESULTS[(2023-03-23 19:27:27) 360d6d35db3eb48deb664349eed34b7541923ca2]:
| sh | bash | zsh | fish | csh | ash | dash | ksh | mksh | posh |

#+begin_src emacs-lisp :results pp
org-babel-shell-set-prompt-commands
#+end_src

#+RESULTS[(2023-03-23 19:27:44) 910fbbafc6fea4a1846f5a31f8b7dd102eca4928]:
: (("fish" . "function fish_prompt\necho \"%s\"\nend")
:  ("csh" . "set prompt=\"%s\"\nset prompt2=\"\"")
:  ("posh" . "function prompt { \"%s\" }")
:  (t . "PROMPT_COMMAND=;PS1=\"%s\";PS2="))

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[CANCELED] Re: [BUG] org-capture got file userlock error when I capture on second time.

2023-03-22 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> When I org-capture from elfeed-entry buffer (I defined custom functions to
>> extract elfeed entry buffer content) in the second time and later, the
>> bellowing error raised up. The first-time capture is fine.
>>
>> Here is the error backtrace:
>> #+begin_example
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>   expand-file-name(nil)
>>   userlock--check-content-unchanged("~/Org/Tasks/Tasks.org")
>
> This looks like some interaction between Org setting `buffer-file-name'
> to nil in *Capture* buffer and Emacs' file locking machinery. Maybe.
> Maybe Emacs bug. I have no better ideas.
>
> I also see nothing wrong we do on Org side.

First, Ihor, I need to thank you. With your hints. I try to figure out
what things might get involved between Org setting `buffer-file-name'
and *Capture* buffer.

1. I try to set `org-capture-mode-hook`, `org-mode-hook' etc to nil.

2. Use bug-hunter to bisect my emacs config, the first start, the
   problem does not occurred, this is weird, even I tried many times.

3. Then I use comment to bisect my init.el, try to figure out the
   reason. Still not found. And the problem not occurred.

4. I start Emacs again with original config. Now the problem gone. I
   restart Emacs many times, problem still not occurred. Weird.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SUGGESTION] ob-shell async result output should not contains shell prompt

2023-03-22 Thread Christopher M. Miles

The ob-shell async result output contains the shell prompt. I think it
should not be captured.

#+begin_src shell :session "test2" :async t
sleep 30
echo "hello, world"
#+end_src

#+RESULTS[(2023-03-23 11:19:22) 461ed5de684f6e619890709175ec73e80b67b2d6]:
: bash-5.2$ hello, world

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] separate ob-clojure.el into Clojure part ob-clojure.el and ClojureScript part ob-clojurescript.el

2023-03-20 Thread Christopher M. Miles

Ihor Radchenko  writes:

> Daniel Kraus  writes:
>
>>> The only downside is that people might need to
>>> (require 'ob-clojurescript)
>>> I am thinking if ob-core.el should try to automatically guess the
>>> correct library to be loaded.
>>
>> We could just (require 'ob-clojurescript) inside ob-clojure.el ?!
>
> Sure. Though it will go against the goal for not loading everything in
> Org on startup. (Currently, Org startup is too slow for some people).
>
> In any case, I was mostly thinking aloud in a broader context, not just
> ob-clojure.el. For ob-clojure, either way is fine.

Yeah, loading only when necessary is great for startup. For non-expert
user, it's helpful, because they don't know configure it well.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [SUGGESTION] separate ob-clojure.el into Clojure part ob-clojure.el and ClojureScript part ob-clojurescript.el

2023-03-20 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> For now, ob-clojure.el contains lot of code for ClojureScript. Only some
>> code has same functionality. Like CIDER backend. In the future,
>> ClojureScript part code will increase and different. So I suggest
>> separate them into two source code files.
>>
>> WDYT?
>
> The only downside is that people might need to
> (require 'ob-clojurescript)
> I am thinking if ob-core.el should try to automatically guess the
> correct library to be loaded.

I think this is an good idea. It let user don't need to load
ob-.el before user really need it. The ob-core.el will
automatically load  related libraries. For now I have to configure
ob-.el like bellowing to defer loading:

#+begin_src emacs-lisp
(use-package ob-clojure
  :custom (org-babel-clojurescript-backend 'cider)
  :commands (org-babel-execute:clojurescript)
  :config
  (add-to-list 'org-babel-load-languages '(clojurescript . t))
  (org-babel-do-load-languages 'org-babel-load-languages 
org-babel-load-languages)
  ;; let `ob-clojurescript' babel source blocks allow evaluation.
  (add-to-list 'org-babel-default-header-args:clojurescript '(:eval . "yes"))
  (add-to-list 'org-babel-default-header-args:clojurescript '(:noweb . "yes")))
#+end_src

The duplicated part code bellowing is repeated for every :

#+begin_src emacs-lisp
(add-to-list 'org-babel-load-languages '(clojurescript . t))
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
#+end_src

>
> Otherwise, I am neutral towards this split.
>
> Up to Daniel.


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[SUGGESTION] separate ob-clojure.el into Clojure part ob-clojure.el and ClojureScript part ob-clojurescript.el

2023-03-20 Thread Christopher M. Miles
For now, ob-clojure.el contains lot of code for ClojureScript. Only some
code has same functionality. Like CIDER backend. In the future,
ClojureScript part code will increase and different. So I suggest
separate them into two source code files.

WDYT?

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Hiding citations

2023-02-25 Thread M . ‘quintus’ Gülker


Am Samstag, dem 25. Februar 2023 schrieb Bruce D'Arcus:
> Not exactly what you're asking for, but have you seen this activate processor?
>
> https://github.com/andras-simonyi/org-cite-csl-activate

Not yet, and it certainly looks nice, but the CSL style I use uses
footnotes, and those are quite verbose. Rendering them (or rather, their
content) into the text would expand it even more.

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Hiding citations

2023-02-25 Thread M . ‘quintus’ Gülker
Dear list,

is there a way to visually hide citations in the org buffer, much like
links are hidden? I ask because if a text passage contains a number of
citations, it quickly becomes hard to read if they are all displayed in
raw format. Here is a paragraph from one of my recently published papers[1]
in its original org markup (language is German):

> Der Begriff „Überwachungsgesamtrechnung“ wurde von
> {{{name(Roßnagel)}}} im Anschluss an die Entscheidung des
> {{{court(BVerfG)}}} zur Vorratsdatenspeicherung geprägt.
> [cite:@roßnagel2010überwgesrech p. 1242,] Er sieht in der Passage, in
> der das {{{court(BVerfG)}}} den Gesetzgeber „in Blick auf die
> Gesamtheit der verschiedenen schon vorhandenen Datensammlungen zu
> größerer Zurückhaltung“ [cite:@bverfg2010vds p. 324,] anhält, den
> Ausgangspunkt für eine doppelte Verhältnismäßigkeitsprüfung, die
> einmal individuell und einmal gesamtgesellschaftlich anhand aller
> bestehenden Überwachungsmaßnahmen in Gesamtschau ausgeführt werden
> müsse. [cite: @roßnagel2010überwgesrech p. 1240,;dem folgend
> @braun-albrecht2017freih_gasse p. 152,;kritisch dazu
> @hornung-schnabel2010bverfgvds p. 827,] Eine solche doppelte
> Verhältnismäßigkeitsprüfung hat das {{{court(BVerfG)}}} aber weder in
> dieser noch in einer anderen Entscheidung durchgeführt. Anderes folgt
> auch nicht aus dem gelegentlichen Rekurs des Gerichts auf eine „große
> Streubreite“. Soweit das {{{court(BVerfG)}}} hierauf zurückgreift,
> wird der Begriff ausschließlich zur Begründung einer hohen
> Eingriffsintensität genutzt, [cite:Vgl. @bverfg2005vorbeug_telek p.
> 383,;@bverfg2010vds p. 318,;@bverfg2018kfz_kennz_ii note 98,] d. h.
> die „große Streubreite“ erhöht die Anforderungen an die später zu
> prüfende Angemessenheit. Eine doppelte Verhältnismäßigkeitsprüfung ist
> damit nicht verbunden.

I use visual-line-mode, so imagine this actually as a single long line.
It contains both macros (which can nicely be condensed with
`org-hide-macro-markers' to improve readability), but some of those
citation constructs are awkwardly long and hinder reading the paragraph
as a whole in the editor, most notably the one with the three citations
right in the middle. I would prefer it it looked like this:

> Der Begriff „Überwachungsgesamtrechnung“ wurde von name(Roßnagel) im
> Anschluss an die Entscheidung des court(BVerfG) zur
> Vorratsdatenspeicherung geprägt. [cite:…] Er sieht in der Passage, in
> der das court(BVerfG) den Gesetzgeber „in Blick auf die Gesamtheit der
> verschiedenen schon vorhandenen Datensammlungen zu größerer
> Zurückhaltung“ [cite:…] anhält, den Ausgangspunkt für eine doppelte
> Verhältnismäßigkeitsprüfung, die einmal individuell und einmal
> gesamtgesellschaftlich anhand aller bestehenden Überwachungsmaßnahmen
> in Gesamtschau ausgeführt werden müsse. [cite:…] Eine solche doppelte
> Verhältnismäßigkeitsprüfung hat das court(BVerfG) aber weder in dieser
> noch in einer anderen Entscheidung durchgeführt. Anderes folgt auch
> nicht aus dem gelegentlichen Rekurs des Gerichts auf eine „große
> Streubreite“. Soweit das court(BVerfG) hierauf zurückgreift, wird der
> Begriff ausschließlich zur Begründung einer hohen Eingriffsintensität
> genutzt, [cite:…] d. h. die „große Streubreite“ erhöht die
> Anforderungen an die später zu prüfende Angemessenheit. Eine doppelte
> Verhältnismäßigkeitsprüfung ist damit nicht verbunden.

This is much more easier to look at and uses the spare screen space in a
much more economic way. Editing citations could follow the same rules as
editing links, that is, if the terminal bracket is removed, everything
becomes visible again (or one just uses special citation-editing
commands).

Does such a feature already exist? If not, I would like to request it. I
however do think that it should be optional, because there is some
useful information inside the citation constructs that might help
reading (and not everyone needs so many and long citation constructs as
my discipline).

  -quintus

[1]: Contained in this open-access conference proceedings volume:
 https://cloud.weizenbaum-institut.de/s/kEyydT72PSSpjSo

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: [PATCH][oc-csl] Improve reference parsing

2023-01-19 Thread M . ‘quintus’ Gülker


Am Donnerstag, dem 19. Januar 2023 schrieb András Simonyi:
> hopefully somebody more knowledgeable than me can comment on how
> viable this is, but would a @@csl like export snippet construct help
> with the problem?
> In that case your macro could be along the lines of
>
> #+MACRO: name @@csl:$1@@

It is an interesting approach, but it has a drawback. I use this macro
also in the ordinary text when I refer to persons without an explicit
citation. That is, the macro has to work both in a citation and in
normal text. Even if a @@csl: construct would be ignored in normal text,
I cannot see how to write the macro then, because something like

#+MACRO: name @@csl:$1latex:\textsc{$1}html:$1@@

would still transfer the @@latex: and @@html: constructs into the
footnote. They would have to be expressly ignored by the citation
processor.

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: [PATCH][oc-csl] Improve reference parsing

2023-01-19 Thread M . ‘quintus’ Gülker


Am Donnerstag, dem 19. Januar 2023 schrieb András Simonyi:
> apologies for replying that late. If I understand the situation
> correctly, we could handle the question of allowing macros in
> citations independently of the handling of other constructs, because
> macros are resolved before processing citations, so they have no
> effect on the input of Citeproc-el.  In light of this, maybe there
> could be a separate patch for just allowing macros?

I am not sure this targets the usecase I am pursuing, which is to use
macros to produce @@latex: escape constructs in order to have small-caps
markup in the citation footnotes:

#+MACRO: name @@latex:\textsc{$1}html:$1@@

If the macro resolves, but the @@latex construct does not, that would be
problematic. That being said, I /found/ an alternative that works,
albeit it is a bit ugly. I can create an explicit footnote, use a
[cite/default/bare:] construct (to suppress the terminal period) within
it and terminate the citation before the macro begins. That way, the
macro is outside of the citation construct. This construction is however
unfortunate when I want to cite multiple sources and have the macro used
on an earlier one, e.g.:

[fn:1] [cite/default/bare:@foo p. 5], countering {{{name(Doe’s)}}} 
argument; [cite/default/bare:@bar p. 37].

It would be nicer if I could just write into the main text

[cite:@foo p. 5, countering {{{name(Doe’s)}}} argument;@bar p. 37]

I can however live with the more elaborate construction, if nothing
else.

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: Beamer export: Executing LaTeX between two frames

2023-01-07 Thread M . ‘quintus’ Gülker
Dear Ihor,

please apologise the slow reply.

Am Sonntag, dem 26. Juni 2022 schrieb Ihor Radchenko:
> This is too hacky as for my taste.
>
> I'd rather use :ignore: tag from ox-extra:

This works decently. I did not know about “ox-extra” before. For
reference, it is here: 
<https://git.sr.ht/~bzg/org-contrib/blob/master/lisp/ox-extra.el>

What I then did was:

(require 'ox-extra)
(ox-extras-activate '(ignore-headlines))

And then export to latex-beamer as usual. Just like Ihor described, the
two headings tagged “:ignore:” are suppressed from the output and the
“\usebackgroundtemplate” macro is properly wrapped around the
non-ignored heading.

Thank you Ihor.

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: Filter for HTML (cite) footnotes?

2023-01-07 Thread M . ‘quintus’ Gülker
Dear all,

I ought to drive this thread to its completion. What I intend to do is
better covered by the new callback functions provided by citeproc-el:
<https://github.com/andras-simonyi/citeproc-el/issues/111>

  -quintus

Am Dienstag, dem 08. März 2022 schrieb Juan Manuel Macías:
> M. ‘quintus’ Gülker writes:
>
>> That is, what I am after effectively, is post-processing the results
>> generated by org-cite resp. citeproc.el. I have names in my
>> bibliographic database like “Axel von Hellfeld”, which contain the
>> German name particle “von”. Some (not all) citation customs require
>> “von” to be abbreviated to “v.” so that the cited name becomes
>> “v. Hellfeld”. This is not possible with CSL, so I look for another
>> way to automate this during the export process.
>
> I see. Have you tried using `org-export-filter-final-output-functions'?
> You can try a find/replace function for the footnotes of final
> output. The drawback is that the scope here is broader and
> care should be taken with false positives...
>
> Best regards,
>
> Juan Manuel 


-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: [PATCH][oc-csl] Improve reference parsing

2023-01-07 Thread M . ‘quintus’ Gülker
Dear all,

I probably have not much to contribute to this rather technical thread,
but Ihor has redirected me here two times for my citation formatting
questions[1][2]. So I would like to ask if there is something I can do to
accelerate its inclusion into org so that I can start using macros in
citations?

  -quintus

[1]: https://list.orgmode.org/orgmode/87o7tb8pc1.fsf@localhost/

[2]: https://list.orgmode.org/orgmode/87zgcw8gtd.fsf@localhost/

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: [BUG] Shift-up/down move the cursor to end of timestamp

2022-12-02 Thread Christopher M. Miles

I meet this bug too.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: OrgModeClockingXBar - see a task when you clock in in your bar and not only

2022-11-14 Thread Christopher M. Miles

mag_dex  writes:

> Dear All,
>
> I designed a hack to see your clocked-in task on your bar (and not only).
>
> The hack is composed of a few elements, Emacs code that adds hooks for 
> clock-in and clock-out and a code
> for Xbar.
>
> I have been using this for 2 years, and it's pretty robust. I didn't have 
> time to share it before.
>
> The code is not perfect, if you quit your Emacs, without clocking-out the 
> content of the file will not be
> changed so you will not see any update on the bar (at least not till next 
> clocking-in or -out)
>
> https://github.com/mmagnus/OrgModeClockingXBar
>
> Magnus

Thanks for sharing, this is what I needed.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Tutorials on creating pdfs with org-babel and sqlite

2022-11-12 Thread Christopher M. Miles

You can check out 
http://www.howardism.org/Technical/Emacs/literate-database.html

This is very great.

Jan Ulrich Hasecke  writes:

> [[PGP Signed Part:Undecided]]
> Dear all,
>
> I am doing my first steps to do some database publishing with org-babel
> and sqlite. So far quite successful, but I am still very new to this, so
> I would appreciate if you can recommend a tutorial on this. I am mostly
> interested in publishing use cases. Has anybody wrote a book or a report
> with org-mode, org-babel and sqlite? What options I have to format the
> output so that I can export it to pdf via pandoc and context?
>
> TIA
> juh
>
>
>
> [[End of PGP Signed Part]]


-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [RFC PATCH] Re: [bug] Macro in citation not expanded

2022-11-11 Thread M . ‘quintus’ Gülker
Dear Ihor,

thank for the WIP patch. I have applied it to current main
(f83e45526b5ec4627d601673be3680e2dece1b33), but when I now export the
document described in the OP to LaTeX, the macro is erased entirely. I
receive:

1 Doe, Nothing important, 2. Aufl. (2022), 55, zum vorgenannten Argument 
aaO.

The same for HTML export.

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: Formatting in citation locator

2022-11-11 Thread M . ‘quintus’ Gülker
Dear all,

apologies for my slow reply. It is currently hard for me to find some
time for these issues, but eventually I do manage it.

Am Mittwoch, dem 26. Oktober 2022 schrieb András Simonyi:
> I've ended up making the necessary changes in citeproc and also posted
> a patch here which should enable formatting in locators. Marvin, I'd
> appreciate it if you could test it.

I have updated citeproc-el to 69536c8776dea383951538fd197333bee766d7c7
and org-mode to Org mode version 9.6-pre (release_9.5-1271-gf83e45 @
/home/quintus/.emacs.d/org-mode/lisp/). However, using the material
provided in the OP, I still do not get a formatted footnote, even with
the zero-width space. The outcome still is

  BVerfGE 125, 260 (373 [Sondervotum /Schluckebier/​])

both in HTML and LaTeX.

GNU Emacs 27.2 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.31, cairo 
version 1.16.0).

  -quintus

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: CI tests

2022-11-06 Thread Christopher M. Miles

Christian Köstlin  writes:

> Dear org-mode users,
>
>
> at the moment I am trying to enable as much of the org-mode testsuite
> on the ci server (see https://builds.sr.ht/~bzg for the latest
> testruns).
>
> From time to time some tests fail, because the time when e.g. a
> timestamp is written to the buffer is different to when the timestamp
> is calculated in the test (the minute just flips there).
>
> The buildserver already stumbled over:
> - test-org/org-log-done
> - test-org-capture/fill-template
> but I think there might be more problems like that.
>
> Did you also see that when running the tests locally?
>
> Kind regards,
> Christian

Feedback: I have not seen those two tests failed on my local running.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Auto detect ob-clojure backend (was: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list)

2022-10-30 Thread Christopher M. Miles

Daniel Kraus  writes:

> Ihor Radchenko  writes:
>
>> Daniel Kraus  writes:
>>
>>> +(defcustom org-babel-clojure-backend (cond
>>> +  ((executable-find "bb") 'babashka)
>>> +  ((executable-find "nbb") 'nbb)
>>> +  ((featurep 'cider) 'cider)
>>> +  ((featurep 'inf-clojure) 
>>> 'inf-clojure)
>>> +  ((featurep 'slime) 'slime)
>>> + (t nil))
>>
>> What if users have, say, cider installed and also babashka executable?
>> Will it be expected to use babashka?
>
> Yes. The only thing that makes me slightly hesitant is that e.g.
> someone doesn't have `bb` installed. Executes clojure source blocks
> which are then evaluated in, let's say cider.
> Then they install `bb` and the next time they start Emacs, the same
> source block on re-evaluation would be executed with babashka.
>
> I think this is still the best out of the box experience as it
> "just works" for most users without having to customise something
> and if they want it fixed, they can pin it to a certain backend.
>
> What's your opinion?
>
> Cheers,
>   Daniel

I vote for use Clojure CLI like bb as default backend. Keeping defcustom
option for user to setting default backend is fine.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[CLOSED] Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-29 Thread Christopher M. Miles

Daniel Kraus  writes:

> Hi
>
> Ihor Radchenko  writes:
>> "Christopher M. Miles"  writes:
>>> Any review comments about this patch?
>> I have sent the following comment shortly after your followup:
>
> I even made another post after that, suggesting that the if condition
> is not even needed. Simply always quoting seems to work and is also the
> way it's done in `ob-lisp.el`.
> See https://list.orgmode.org/orgmode/874jvp9wsg@kraus.my/
>
> This simple patch is also already installed. Can you test if that works for 
> you?
>
> And in case you missed it, I made another reply for you bug report
> about inline comments.
> Check https://list.orgmode.org/orgmode/878rl1a1e0@kraus.my/
>
> Thanks,
>   Daniel

Indeed, your solution is better. Sorry that I have not realized your
patch. Thanks for notify me again. Closed this thread now.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


  1   2   3   4   5   6   7   8   9   10   >