Re: Bug: html-postamble string does not allow space [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/27.2/lisp/org/)]

2022-11-15 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Fixed in the attached.

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=84b487868
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d4299eeac
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5c247fb27


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



Re: [BUG] ob-octave.el

2022-11-15 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Thanks for reporting, and sorry for the late reply.
> Your suggestion looks fine, although I am a bit concerned if the
> trailing newline in the old version was significant.

Applied onto main.
Fixed.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d09413538

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



[PATCH] Display ?? for missing citations on export (was: [BUG] Exporting non-existent citations in oc-basic [9.6-pre (release_9.5.5-989-gd972cf @ /home/yantar92/.emacs.d/straight/build/org/)])

2022-11-15 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Consider the following Org file:
>
> 
> [cite:@key]
> #+print_bibliography:
> That’s it!
> 
> @key is not in the default bibliography and the bibliography processor is set 
> to basic
>
> Open the file and execute C-c C-e t U (export to ascii)
>
> An error is thrown and export fails when attempting to print the
> bibliography.

The problem with error has been solved in another patch.

However, the non-existing keys are exported awkwardly as "(, )".

I suggest approaching the missing citations similar to LaTeX and
highlight them with ??: (??, ) by default.

See the attached patch.

WDYT?

>From dc26b1d84c7745080f26e0f194a4deb003a0f88f Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Wed, 16 Nov 2022 12:29:17 +0800
Subject: [PATCH] oc-basic: Display ?? in place of missing citations on export

* lisp/oc-basic.el (org-cite-basic--format-author-year):
(org-cite-basic-export-citation): Display "" for missing year and
"??"  for missing other fields.

Reported-by: Ihor Radchenko 
Link: https://orgmode.org/list/871qr6kiuv.fsf@localhost
---
 lisp/oc-basic.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 3ef7a37e3..fdfee849e 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -580,8 +580,8 @@ (defun org-cite-basic--format-author-year (citation format-cite format-ref info)
  (suffix (org-element-property :suffix ref)))
  (funcall format-ref
   prefix
-  (org-cite-basic--get-author k info)
-  (org-cite-basic--get-year k info)
+  (or (org-cite-basic--get-author k info) "??")
+  (or (org-cite-basic--get-year k info) "")
   suffix)))
  (org-cite-get-references citation)
  org-cite-basic-author-year-separator)
@@ -652,15 +652,17 @@ (defun org-cite-basic-export-citation (citation style _ info)
  (org-export-data
   (mapconcat
(lambda (key)
- (let ((author (org-cite-basic--get-author key info)))
-   (if caps (capitalize author) author)))
+ (or
+  (let ((author (org-cite-basic--get-author key info)))
+(if caps (capitalize author) author))
+  "??"))
(org-cite-get-references citation t)
org-cite-basic-author-year-separator)
   info)))
   ;; "noauthor" style.
   (`(,(or "noauthor" "na") . ,variant)
(format (if (funcall has-variant-p variant 'bare) "%s" "(%s)")
-   (mapconcat (lambda (key) (org-cite-basic--get-year key info))
+   (mapconcat (lambda (key) (or (org-cite-basic--get-year key info) ""))
   (org-cite-get-references citation t)
   org-cite-basic-author-year-separator)))
   ;; "nocite" style.
-- 
2.35.1


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


Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-11-15 Thread Samuel Wales
idk if related to this thread, but i sure do appreciate the effor in
this thread to solve such problems.  it is a key feature for me
because i am often in mouse-only mode.  it is thus a constant concern
that org-capture could stop working etc.

right now, it seems org-capture is broken for me again.  clicking on
unicorn results in the momentary captured indication in huge text on
the screen [i like this indicator], but it does not get captured to my
org capture target.

this is with or without selecting any text.

could a kind soul remind me how to debug this again?

i have made no changes to my capture template or code in a very long
time.  i don't think firefox-esr has updated recently.


On 11/13/22, Ihor Radchenko  wrote:
> Max Nikulin  writes:
>
>>> I am unsure what can be done here. AFAIU, Org just follows the %x
>>> description. Nothing wrong on Org side.
>>>
>>> The best we can do is alternative %?? that will do something more
>>> reliable. But I am unsure what it can be.
>>
>> Depending of particular capture template (even with :immediate-finish t)
>> empty selection may or may not be an error. In Samuel's case it is an
>> error. Unfortunately, while the template is processed, signaled errors
>> are caught and their text is inserted into the text. That is why in my
>> example I put checks outside of `org-capture'.
>
> Are you sure? `org-get-x-clipboard' returns nil in case of error and
> `org-capture-fill-template' assigns empty string to v-x when no
> clipboard value can be obtained.
>
>> We may:
>> - Add a capture template option that allows errors to pass through to
>> the caller. Then a user may add %(...) expression with all necessary
>> checks.
>
> I am not very sure what kind of errors you are talking about. AFAIU, we
> are talking about scenarios when user explicitly wants one of
> PRIMARY/CLIPBOARD/SECONDARY, don't we?
>
 2. Jean pointed out that Emacs ignores X selection if it does not have
 an X frame. It was almost buried in the haystack of "SQL instead of
 Org"
 noise. It happens if Emacs is running as a daemon. I am unsure which
 way
 Samuel starts Emacs (xinit, systemd user session, systemd socket
 activation, manually, etc.)
>>>
>>> May we modify org-get-x-clipboard adding
>>> (server-select-display (getenv \"DISPLAY\")) ?
>>> Will it be enough?
>>
>> It will work for most of users, however sometimes it is incorrect. There
>> are a number of options that should have higher priority than emacs
>> server DISPLAY environment
>> - emacsclient -display command line option,
>> - emacsclient process DISPLAY environment,
>> - emacs -display server argument.
>>
>> I have no idea how to get "emacs -display" argument and I need to look
>> into emacsclient source and server.el to figure out which way client's
>> display argument is passed to the server process.
>
> Maybe it can be considered an Emacs bug or something to improve on Emacs
> side?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

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



Re: [BUG] Missing definitions for some customization groups [9.5.5 (release_9.5.5 @ /snap/emacs/current/usr/share/emacs/28.2/lisp/org/)]

2022-11-15 Thread Ihor Radchenko
Kyrylo Simonov  writes:

>> Confirmed.
>> Would you be interested to create a patch? It is mostly a question of
>> adding a bunch of `defgroup' statements.
>
> I attached a patch.  Where it made sense, I added a new defgroup
> declaration.  For other cases, I moved the variables under some
> existing group.

Thanks!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=00778ce2a

You are now also listed as an Org contributor.
https://git.sr.ht/~bzg/worg/commit/9f330e70

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



Re: [PATCH v2] org-attach.el: ID to path functions may return nil

2022-11-15 Thread Ihor Radchenko
Max Nikulin  writes:

>>> Please, remove a stray space in the defcustom.
>> 
>> Hmm. Done.
>> 
>> I just have a habit to add space in the first item in a list because it
>> helps auto-indentation.
>
> I had an impression that something was wrong with indentation of next 
> entries.

I thought that you referred to '(symbol ...
Other stray spaces were there because I forgot to disable nameless-mode.

> Sorry, but "important" entry should be before 
> `org-attach-id-uuid-folder-format'. My idea is the following:
> - If the ID was generated by 'uuid or 'org `org-id-method' then prefer 
> XX/... subfolder. It is important for new attachments. Even if current 
> `org-id-method' is 'ts then this entry is ignored and layout is 
> determined by the next entry.
> - If the ID is timestamp-based then prefer "MM/DDTIME" subfolder.
> - Put new non-standard IDs to important/X/... subfolder whenever 
> particular ID is a short or a long one.
> - Handle the case of `org-id-method' changed in the past from timestamp 
> to UUID or vice versa. Try to find attachment trying to split 2 
> characters from timestamp or 6 characters from UUID. So add bare 
> `org-attach-id-uuid-folder-format' and `org-attach-id-ts-folder-format'. 
> These 2 entries may be skipped for new users or for users who never 
> experienced change of `org-id-method'.

Agree.
I now applied the updated version of the patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=08a8c9e67

 I also added the dumb fallback to the default value.
 I feel that otherwise the description of too confusing.
>>>
>>> I am unsure concerning adding it to the default value. From my point of
>>> view, it is better to ask user to clarify their intention.
>
>> Handling too short IDs is a different issue indeed, but why not to fix
>> it as well?
>
> I still have a different opinion, but it should not prevent you from 
> committing your variant. The issue is not critical.
>
> The problem is not too short ID. Actually they are some ID having 
> unknown format, so functions designed for particular ID generation 
> methods may cause a mess in attachment subdirs.

>>> If strict variants of functions were used above then non-standard IDs
>>> would be isolated in the directory returned by the next entry
>> 
>> Good point.
>> What about using the value you provided in the NEWS as an actual default?
>
> It may be done by a next patch unless other issues will attract more 
> attention.

I guess it does not heart to wait a bit. Though I do not see any issue
with updating the defaults to your version.

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



Re: org-clock-report on headings and subheadings or for the whole file?

2022-11-15 Thread Ihor Radchenko
Uwe Brauer  writes:

>> Uwe Brauer  writes:
>
>> What about the attached patch?
>
> Sounds good to me

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=21413d358

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



Re: 2 'echo' bash instructions produce a table

2022-11-15 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> In 16.5 (Evaluating Code Blocks), in this code
>>
>>#+NAME: random
>>#+BEGIN_SRC R :cache yes
>>  runif(1)
>>#+END_SRC
>>
>> the (1) seems to be understood as a footnote in Info, at least for me.
>> E.g.,  on it goes to the footnote
>>
>>(1) The option ‘org-babel-no-eval-on-ctrl-c-ctrl-c’ [...]
>>
>> and  on this (1) goes back to the above code instead of to the
>> actual call
>>
>>"Org provides many ways to execute code blocks.  ‘C-c C-c’ or ‘C-c
>>C-v e’ with the point on a code block(1)"
>
> Confirmed, but it does not look like Org's fault.

Reported to Emacs devs.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59293

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



Re: [BUG] Missing definitions for some customization groups [9.5.5 (release_9.5.5 @ /snap/emacs/current/usr/share/emacs/28.2/lisp/org/)]

2022-11-15 Thread Kyrylo Simonov

On 11/14/22 02:42, Ihor Radchenko wrote:

Kyrylo Simonov  writes:


Some of the customization groups in org-mode lack defgroup declaration.
Specifically, they are:
(org-gnus org-startup org-export-pdf org-bbdb org-babel-tangle
org-bibtex org-plot)

In the *Customize* interface, these subgroups are not accessible from
the main Org customization page and vice versa.  To reproduce, type
"M-x customize-group org" and witness that, for example, Org Startup
subgroup is not listed.  Then type "M-x customize-group org-startup" and
see that the group definition and the link to the parent group are
missing.

Confirmed.
Would you be interested to create a patch? It is mostly a question of
adding a bunch of `defgroup' statements.


I attached a patch.  Where it made sense, I added a new defgroup
declaration.  For other cases, I moved the variables under some
existing group.

Thanks, Kyrylo
From 7be0b6eb51748ccf044fffb87020c27fe9dca81e Mon Sep 17 00:00:00 2001
From: Kyrylo Simonov 
Date: Tue, 15 Nov 2022 22:49:56 +
Subject: [PATCH] Fix missing customization groups

* lisp/ob-tangle.el (org-babel-tangle): Add missing group definition.
(org-babel-post-tangle-hook):
(org-babel-pre-tangle-hook):
(org-babel-tangle-body-hook):
(org-babel-tangle-finished-hook):
(org-babel-tangle-comment-format-beg):
(org-babel-tangle-comment-format-end):
(org-babel-tangle-uncomment-comments):
(org-babel-process-comment-text):
(org-babel-tangle-default-file-mode): Move under `org-babel-tangle'
group.
* lisp/ol-bbdb.el (org-bbdb-anniversaries): Move under `org-agenda'
instead of a non-existent `org-bbdb'.
* lisp/ol-bibtex.el (org-bibtex): Add missing group definition.
* lisp/ol-gnus.el (org-gnus-no-server): Move under group
`org-link-follow' instead of a non-existent `org-gnus'.
* lisp/org-plot.el (org-plot): Add missing group definition.
* lisp/org.el (org-startup): Add missing group definition.
* lisp/ox-latex.el (org-latex-pdf-process): Move under
`org-export-latex' instead of a non-existent `org-export-pdf'.
* lisp/ox-man.el (org-man-pdf-process): Remove reference to
non-existent group `org-export-pdf'.

TINYCHANGE
---
 lisp/ob-tangle.el | 23 ++-
 lisp/ol-bbdb.el   |  2 +-
 lisp/ol-bibtex.el |  5 +
 lisp/ol-gnus.el   |  2 +-
 lisp/org-plot.el  |  5 +
 lisp/org.el   |  5 +
 lisp/ox-latex.el  |  2 +-
 lisp/ox-man.el|  1 -
 8 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 5074880c4..e86f4e528 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -51,6 +51,11 @@
 (declare-function outline-previous-heading "outline" ())
 (defvar org-id-link-to-org-use-id) ; Dynamically scoped
 
+(defgroup org-babel-tangle nil
+  "Options for extracting source code from code blocks."
+  :tag "Org Babel Tangle"
+  :group 'org-babel)
+
 (defcustom org-babel-tangle-lang-exts
   '(("emacs-lisp" . "el")
 ("elisp" . "el"))
@@ -73,26 +78,26 @@ then the name of the language is used."
 
 (defcustom org-babel-post-tangle-hook nil
   "Hook run in code files tangled by `org-babel-tangle'."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
 (defcustom org-babel-pre-tangle-hook '(save-buffer)
   "Hook run at the beginning of `org-babel-tangle' in the original buffer."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
 (defcustom org-babel-tangle-body-hook nil
   "Hook run over the contents of each code block body."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
 (defcustom org-babel-tangle-finished-hook nil
   "Hook run at the very end of `org-babel-tangle' in the original buffer.
 In this way, it is the counterpart to `org-babel-pre-tangle-hook'."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :package-version '(Org . "9.6")
   :type 'hook)
 
@@ -112,7 +117,7 @@ non-nil value.
 
 Whether or not comments are inserted during tangling is
 controlled by the :comments header argument."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'string)
 
@@ -132,7 +137,7 @@ non-nil value.
 
 Whether or not comments are inserted during tangling is
 controlled by the :comments header argument."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'string)
 
@@ -141,7 +146,7 @@ controlled by the :comments header argument."
 of tangle comments.  Use `org-babel-tangle-comment-format-beg'
 and `org-babel-tangle-comment-format-end' to customize the format
 of tangled comments."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :type 'boolean)
 
 (defcustom org-babel-process-comment-text 'org-remove-indentation
@@ -149,7 +154,7 @@ of tangled comments."
 inserted as comments in tangled source-code files.  The function
 should take a single string argument and return a string
 result.  The default value is `org-remove-indentation'."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'function)
 

Re: [PATCH] lisp/ob-octave.el, was [PATCH] rfc: using ert-deftest with side-effects

2022-11-15 Thread Leo Butler
On Mon, Nov 14 2022, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>> The amended patch is attached. Thanks for your helpful feedback.
>
> Thanks for the patch!
> It looks good, and the tests are passing. However, there is a side effect
> leaving testing/examples/octave-workspace file after running the tests.
>
> Can something be done about this?

Yes, sorry about that, I should have caught that while testing the
patch. the amended patch (attached) prevents Octave from dumping a core
file when running the :session test.

Best,
Leo

From 386c9c2f65730459bdc69b2e0b0b76e22e32dbc9 Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Tue, 8 Nov 2022 13:31:47 -0600
Subject: [PATCH] prevent error in Octave process, add tests, update test docs

* lisp/ob-octave.el (org-babel-execute:octave):

  -Ensure that the special Octave variable `ans' is bound when
  GFX-FILE is non-nil.  The glue code in
  ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a
  non-zero exit code when `ans' is not bound.

  -Change format control string to %S from %s.  Ensure the graphics
  filename is quoted.  If it is not, Octave may create a mis-named
  file or fail entirely.

* testing/examples/ob-octave-test.org:

  Update the Graphical tests section:
  -put in the correct headers;
  -add a remark about where to find each test.

* testing/lisp/test-ob-octave.el:

  Add the three tests ob-octave/graphics-file,
  ob-octave/graphics-file-session and ob-octave/graphics-file-space.

  -ob-octave/graphics-file: The first test verifies that the first bug
  identified above is fixed; it also verifies that graphics file
  creation works correctly for scripting.

  -ob-octave/graphics-file-session: The second test verifies graphics
  file creation works correctly for sessions.  The Octave command
  `crash_dumps_octave_core(0)' is included to prevent the creation of
  a core file (`octave-workspace').

  -ob-octave/graphics-file-space: The third test verifies that a
  graphics filename with a space in it is created correctly.

Thanks to Ihor Radchenko for helpful feedback.
Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
---
 lisp/ob-octave.el   |  2 +-
 testing/examples/ob-octave-test.org | 12 +-
 testing/lisp/test-ob-octave.el  | 65 +
 3 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 55926b789..1cb0e70b5 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -91,7 +91,7 @@ end")
  (list
   "set (0, \"defaultfigurevisible\", \"off\");"
   full-body
-  (format "print -dpng %s" gfx-file))
+  (format "print -dpng %S\nans=%S" gfx-file gfx-file))
  "\n")
 		full-body)
 		  result-type matlabp)))
diff --git a/testing/examples/ob-octave-test.org b/testing/examples/ob-octave-test.org
index 9839d637e..bc19051a1 100644
--- a/testing/examples/ob-octave-test.org
+++ b/testing/examples/ob-octave-test.org
@@ -46,10 +46,18 @@ ans = s
 
 
 * Graphical tests
-#+begin_src octave :results graphics :file chart.png
+
+Graphics file.  This test is performed by =ob-octave/graphics-file= in =testing/lisp/test-ob-octave.el=.
+#+begin_src octave :results file graphics :file sombrero.png
+sombrero;
+#+end_src
+
+Graphics file in a session.  This test is performed by =ob-octave/graphics-file-session= in =testing/lisp/test-ob-octave.el=.
+#+begin_src octave :session :results graphics file :file sombrero.png
 sombrero;
 #+end_src
 
-#+begin_src octave :session
+Graphics file with a space in name.  This test is performed by =ob-octave/graphics-file-space= in =testing/lisp/test-ob-octave.el=.
+#+begin_src octave :results graphics file :file sombrero hat.png
 sombrero;
 #+end_src
diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index 78ce10214..57f40d00b 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -64,4 +64,69 @@
 (org-babel-next-src-block 5)
 (should (equal nil (org-babel-execute-src-block)
 
+(ert-deftest ob-octave/graphics-file ()
+  "Graphics file.  Test that link is correctly inserted and graphics file is created (and not empty).  Clean-up side-effects."
+  ;; In case a prior test left the Error Output buffer hanging around.
+  (when (get-buffer "*Org-Babel Error Output*")
+(kill-buffer "*Org-Babel Error Output*"))
+  (let ((file (make-temp-file "test-ob-octave-" nil ".png")))
+(unwind-protect
+(org-test-with-temp-text
+	(format "#+begin_src octave :results file graphics :file %s
+sombrero;
+#+end_src"
+		file)
+  (org-babel-execute-src-block)
+  (should (search-forward (format "[[file:%s]]" file) nil nil))
+  (should (file-readable-p file))
+  (should (> (file-attribute-size (file-attributes file)) 0))
+  (should-not (get-buffer "*Org-Babel Error Output*")))
+  ;; clean-up
+  (delete-file file)
+  (when (get-buffer "*Org-Babel Error Output*")
+

Re: [OT] org and diff

2022-11-15 Thread Max Nikulin

On 13/11/2022 13:06, Samuel Wales wrote:

On 11/12/22, Ihor Radchenko wrote:

I have the following in my ~/.gitconfig:

[diff "org"]
   xfuncname = "^(\\*+ +.*)$"


Thank you for sharing this. I was sure it should be possible, but I was 
not motivated enough to configure hunk headers for elisp and org. It 
seems even a shorter regexp works well

xfuncname = "^\\*+ .*"


[core]
attributesfile = /home/yantar92/.gitattributes


Git may find ~/.config/git/attributes without explicit configuration


this looks interesting.  i thought this stuff was just for configuring
the helper text on the hunk headers that tell you what function the
hunk is in, kind of thing.


I am unsure that it affects diff as well. Once I have experienced noisy 
diff on attempt to refile a subtree. Finally I did it by moving headings 
by small portions. It allowed to confirm changes during each steps.



Source: https://protesilaos.com/codelog/2021-01-26-git-diff-hunk-elisp-org/


idk why but this page is blank for me.  then if i try to disable
noscript restrictions, noscript says "This is a privileged page, whose
permissions cannot be configured".


Perhaps you were unlucky to fetch the page during server maintenance. 
Firefox-106 renders the page with active NoScript.


The approach is documented in the "Defining a custom hunk-header" 
section of gitattributes(5).


The value of the page is that it has a recipe for elisp (indented 
`cl-defstruct' is not handled though).





Re: [PATCH v2] org-attach.el: ID to path functions may return nil

2022-11-15 Thread Max Nikulin

On 15/11/2022 09:41, Ihor Radchenko wrote:

Max Nikulin writes:


Please, remove a stray space in the defcustom.


Hmm. Done.

I just have a habit to add space in the first item in a list because it
helps auto-indentation.


I had an impression that something was wrong with indentation of next 
entries.



I also added the dumb fallback to the default value.
I feel that otherwise the description of too confusing.


I am unsure concerning adding it to the default value. From my point of
view, it is better to ask user to clarify their intention.



Handling too short IDs is a different issue indeed, but why not to fix
it as well?


I still have a different opinion, but it should not prevent you from 
committing your variant. The issue is not critical.


The problem is not too short ID. Actually they are some ID having 
unknown format, so functions designed for particular ID generation 
methods may cause a mess in attachment subdirs.



If strict variants of functions were used above then non-standard IDs
would be isolated in the directory returned by the next entry


Good point.
What about using the value you provided in the NEWS as an actual default?


It may be done by a next patch unless other issues will attract more 
attention.



`org-attach-id-uuid-folder-format' and `org-attach-id-ts-folder-format'
here were added for users changed `org-id-method' in the past and so
having mixed subdirs layout with UUIDs in 6 character prefix directories
or timestamps in two characters folders.


Agree. Fixed.



+(setq org-attach-id-to-path-function-list
+  '(;; When ID looks like an UUIDs or Org internal ID, use
+;; `org-attach-id-uuid-folder-format'.
+(lambda (id)
+  (and (or (org-uuidgen-p id)
+  (string-match-p "[0-9a-z]\\{12\\}" id))
+  (org-attach-id-uuid-folder-format id)))
+;; When ID looks like a timestap-based ID. Group by year-month
+;; folders.
+(lambda (id)
+  (and (string-match-p "[0-9]\\{8\\}T[0-9]\\{6\\}\.[0-9]\\{6\\}" id)
+   (org-attach-id-ts-folder-format id)))
+;; Fallback to handle previous defaults.
+org-attach-id-uuid-folder-format
+org-attach-id-ts-folder-format
+;; Any other ID goes into "important" folder.
+(lambda (id) (format "important/%s/%s" (substring id 0 1) id


Sorry, but "important" entry should be before 
`org-attach-id-uuid-folder-format'. My idea is the following:
- If the ID was generated by 'uuid or 'org `org-id-method' then prefer 
XX/... subfolder. It is important for new attachments. Even if current 
`org-id-method' is 'ts then this entry is ignored and layout is 
determined by the next entry.

- If the ID is timestamp-based then prefer "MM/DDTIME" subfolder.
- Put new non-standard IDs to important/X/... subfolder whenever 
particular ID is a short or a long one.
- Handle the case of `org-id-method' changed in the past from timestamp 
to UUID or vice versa. Try to find attachment trying to split 2 
characters from timestamp or 6 characters from UUID. So add bare 
`org-attach-id-uuid-folder-format' and `org-attach-id-ts-folder-format'. 
These 2 entries may be skipped for new users or for users who never 
experienced change of `org-id-method'.






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

2022-11-15 Thread Max Nikulin

On 15/11/2022 17:57, mag_dex wrote:


$ emacsclient --eval '(if (org-clocking-p)(org-clock-get-clock-string) -1)’


Consider adding `org-no-properties'.





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

2022-11-15 Thread mag_dex


> On 15 Nov 2022, at 02:41, Ihor Radchenko  wrote:
> 
> "Christopher M. Miles"  writes:
> 
>>> https://github.com/mmagnus/OrgModeClockingXBar
>>> 
>>> Magnus
>> 
>> Thanks for sharing, this is what I needed.
> 
> Do we have a page in WORG that discusses ways to display clocked task in
> taskbar for Linux/Windows/Mac?
> 
I’m sure, I will look it up.

BTW, two people at reddit shared their solutions, with one just like this:
$ emacsclient --eval '(if (org-clocking-p)(org-clock-get-clock-string) -1)’
(maybe for Emacs nerds this is obvious, for me, I didn’t know that I could 
—eval emacs, pretty rad)

I added links to their solutions to the readme of: 
https://github.com/mmagnus/EmacsOrgModeClockingXBar

Magnus

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