How can I get capture-link to stop bugging me about mairix?

2022-04-06 Thread Tory S. Anderson
I upgraded orgmode recently and added org-contrib to my loading. I'm not sure 
if that's related or not, but suddenly, when I invoke org-capture on a Gnus 
message (which used to happen seamlessly) suddenly I am getting the following 
selection message, asking me whether I want org-mairix-store-gnus-link or the 
old working  default org-gnus-store-link . This is the first time I have ever 
heard of Mairix, and I can't find any customizations to set to get it to stop 
asking me.

http://images.toryanderson.com/org-link-mairix.png

How can I get it to stop asking me to select org-gnus-store-link?

- Tory



[BUG] error when saving a new capture [9.5.2 (9.5.2-g971eb6 @ /home/torysa/emacs/.emacs.d/straight/build/org/)]

2022-04-06 Thread Tory S. Anderson


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


I was just saving a capture, no link or anything else. It bound up the thread 
until I could C-g out of it. 

Emacs  : GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, 
cairo version 1.16.0)
 of 2021-09-01
Package: Org mode version 9.5.2 (9.5.2-g971eb6 @ 
/home/torysa/emacs/.emacs.d/straight/build/org/)

current state:
==
(setq
 org-special-ctrl-o nil
 org-link-elisp-confirm-function 'yes-or-no-p
 org-agenda-diary-file "~/org/agenda.org"
 org-directory "~/org/"
 org-agenda-skip-deadline-prewarning-if-scheduled t
 org-agenda-start-with-clockreport-mode t
 org-after-todo-state-change-hook '(org-checklist)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-agenda-custom-commands '(("l" . "schooL")
  ("ld" "schooL Day"
   ((agenda ""
 ((org-agenda-span 1) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset '("+:CLASS:" 
"-:TSA:")))
 )
)
   nil)
  ("lw" "schooL Week"
   ((agenda ""
 ((org-agenda-span 7) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset '("+:CLASS:" 
"-:TSA:")))
 )
)
   nil)
  ("lm" "schooL Month"
   ((agenda ""
 ((org-agenda-span 'month) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset '("+:CLASS:" 
"-:TSA:")))
 )
)
   nil)
  ("p" . "Priesthood")
  ("pd" "Priesthood Day"
   ((agenda ""
 ((org-agenda-span 1) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:PRIESTHOOD:" "-:TSA:")))
 )
)
   nil)
  ("pw" "Priesthood Week"
   ((agenda ""
 ((org-agenda-span 7) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:PRIESTHOOD:" "-:TSA:")))
 )
)
   nil)
  ("pm" "Priesthood Month"
   ((agenda ""
 ((org-agenda-span 'month) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:PRIESTHOOD:" "-:TSA:")))
 )
)
   nil)
  ("w" . "Work")
  ("wd" "Work Day"
   ((agenda ""
 ((org-agenda-span 1) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:ODH:\\|:AGENDA:\\|:CONFERENCE:" "-:TSA:\\|:PRIESTHOOD:")))
 )
)
   nil)
  ("ww" "Work Week"
   ((agenda ""
 ((org-agenda-span 7) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:ODH:\\|:AGENDA:\\|:CONFERENCE:" "-:TSA:\\|:PRIESTHOOD:")))
 )
)
   nil)
  ("wm" "Work Month"
   ((agenda ""
 ((org-agenda-span 'month) 
(org-agenda-start-on-weekday nil)
  (org-agenda-regexp-filter-preset 
'("+:ODH:\\|:AGENDA:\\|:CONFERENCE:" "-:TSA:\\|:PRIESTHOOD:")))
 )
)
   nil)
  ("n" . "Non-work")
  ("nd" "Non-work Day"
   ((agenda ""
 ((org-agenda-span 1) 
(org-agenda-start-

`M-x org-open-at-point` on `[[file:/path/file.hs][name]]` says: "Running less /home/path/file.hs"

2022-04-06 Thread chris
[was: Issue with internal directory links]

> 
> Hi Jonathan,
> 
> Jonathan Fox  writes:
> 
>> Here's a link I'm using:
>>
>> [[./templates][Templates]]
> 

I have similar issue with `[[file:/path/file.hs][name]]`
`M-x org-open-at-point` says:
"Running less /home/path/file.hs"
In terminal:
`mimetype /home/path/file.hs` => `text/x-haskell`

```
org-file-apps is a variable defined in ‘org.el’.
Its value is
((auto-mode . emacs)
 (directory . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))
```

I guess I can configure it alright, but I have no idea why it is invoking 
`less` in the first 
place. I also have no idea where the output of `less` should be found.

`org-version` => 9.5.2
`emacs-version` => 29.0.50

Thanks,
Chris


> You can try adding (directory . emacs) to `org-file-apps' in your
> configuration like this:
> 
> (setq org-file-apps
>   '((auto-mode . emacs)
>   (directory . emacs)
>   ("\\.mm\\'" . default)
>   ("\\.x?html?\\'" . default)
>   ("\\.pdf\\'" . default)))
> 
> A bug related to mailcap handling has been fixed in Emacs 27,
> perhaps this is what caused the change in your setup.  I added
> (directory . emacs) in `org-file-apps' by default in the master
> branch.
> 
> Thanks for reporting this,
> 
> -- 
>  Bastien



[SOLVED] Re: How can I get capture-link to stop bugging me about mairix?

2022-04-06 Thread Tory S. Anderson
web...@toryanderson.com (Tory S. Anderson) writes:

> I upgraded orgmode recently and added org-contrib to my loading. I'm not sure 
> if that's related or not, but suddenly, when I invoke org-capture on a Gnus 
> message (which used to happen seamlessly) suddenly I am getting the following 
> selection message, asking me whether I want org-mairix-store-gnus-link or the 
> old working default org-gnus-store-link . This is the first time I have ever 
> heard of Mairix, and I can't find any customizations to set to get it to stop 
> asking me.
>
> http://images.toryanderson.com/org-link-mairix.png
>
> How can I get it to stop asking me to select org-gnus-store-link?
>
> - Tory

I found and customized =org-link-parameters= to no longer include the Mairix 
lines, which were probably created when I included all the contrib with 
straight. The problem is gone now.

By the way, it would be nice if there were a compliment to =org-add-link-type= 
like =org-remove-link-type=. I was surprised to have one but not the other.

- Tory



Re: [BUG] error when saving a new capture [9.5.2 (9.5.2-g971eb6 @ /home/torysa/emacs/.emacs.d/straight/build/org/)]

2022-04-06 Thread Tim Cross


web...@toryanderson.com (Tory S. Anderson) writes:

> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
>  https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> 
>
> I was just saving a capture, no link or anything else. It bound up the thread 
> until I could C-g out of it. 
>
> Emacs  : GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 
> 3.24.29, cairo version 1.16.0)
>  of 2021-09-01
> Package: Org mode version 9.5.2 (9.5.2-g971eb6 @ 
> /home/torysa/emacs/.emacs.d/straight/build/org/)
>

My first suggestion would be to do an Emacs upgrade. Your running a
pre-release version (Emacs 28.0.50) which for a development version is
extremely old (over 6 months and isn't even one of the release candidate
builds for Emacs 28). Note also that Emacs 28.1 has been released.

The second thing I would do following upgrade is to try and reproduce
the issue using emacs -Q.

Finally, you need to provide more specific details. In order for anyone
to help or debug any issue, the first critical step is to be able to
reproduce it. As it stands now, there is nowhere near sufficient
information to do that. The best thing you can do to help is try to
reproduce the issue in a default configuration (i.e. emacs -Q), which
will help ensure the issue has not been introduced by additional
packages you have installed or any customisation you have done and
providing a minimal recipe to reproduce the issue. Generally, if someone
is able to provide a simple recipe which reliably reproduces the issue,
the issue will be resolved very quickly. If on the other hand, nobody can
reproduce the issue, it probably won't ever be fixed. 



Thanks for good docs

2022-04-06 Thread Matt
Hi,

I'm spending more time writing this email than took me to look up what the 
source block switch is for line numbering.  I had an idea of what I wanted and 
didn't know where to look.  Jump into info, go to the org manual, do a few 
searches across menu and node titles. Then I check the index and there's 
something promising...takes me right to what I was looking for.  Thanks for 
indexing.  Thanks for including examples.  So much better than internet search 
engines.  Y'all are doing good things.  :)

Thanks,
Matt



Re: Drop defadvice from Org

2022-04-06 Thread Ihor Radchenko
Bastien Guerry  writes:

> Stefan Monnier  writes:
>
>> The patch below gets rid of the old `defadvice`, replacing it with
>> `advice-add`.
>
> Applied in the main branch as 6d73cd34a, thanks a lot!

The change in (eval ...) call inside org-diary-sexp-entry broke sexp
timestamps. See orgmode.org/list/875ynnojvf.fsf@localhost

I think that calendar-related evals should be reverted to use dynamic
scope. AFAIU, diary staff is relying on dynamic scope and cannot be used
with lexical.

Best,
Ihor





Re: org-cite styles don't allow * in them

2022-04-06 Thread Ihor Radchenko
"Bruce D'Arcus"  writes:

> On Sun, Apr 3, 2022 at 5:07 PM John Kitchin  wrote:
>>
>> I was looking into using latex commands as styles in org-cite, e.g.
>>
>> [cite/citet:@key]. That example works fine, but [cite/citet*:@key] is not 
>> allowed. Could that be allowed?
>
> I have no insight into the restriction, but I hope it can be removed.

I do like the proposal in general, but I can see a potential issue for
users. Constructs like "word*:" can be recognised as a valid bold
emphasis ending. For example:

>>> Some *bold emphasis with reference [cite/citet*:@key] will end
>>> at "citet*", but not here*.

Note that inserting zero-width space will not only be awkward here, but
also breaks parser: e.g. [cite/citet:@key] is not currently
recognised as a citation.

Best,
Ihor



inconsistent behavior for completion of links inside [[ ]]

2022-04-06 Thread Majzoub, Eric
emacs: 29.0.50 build 7
org: 9.6-gcbe3f2 snapshot from 20220402
I use company for completion.

The issue is very simple to reproduce. Open a new .org file and
input (for example)

[[/home/]]

and see if an auto-complete menu pops up.

Do this both INSIDE your org-directory and OUTSIDE your org-directory.
For me this fails inside my org-directory (at any depth within ~/org).

The output of "C-h m" is:

Enabled minor modes: All-The-Icons-Completion All-The-Icons-Ibuffer
Async-Bytecomp-Package Auto-Composition Auto-Compression
Auto-Encryption Blink-Cursor Column-Number Company Company-Posframe
Diredfl-Global Display-Time Doom-Modeline Electric-Indent
Electric-Pair File-Name-Shadow Flyspell Font-Lock Global-Company
Global-Eldoc Global-Font-Lock Global-Tab-Line Line-Number Menu-Bar
Mouse-Wheel Org-Appear Org-Bullets Org-Indent Org-Remark
Org-Remark-Global-Tracking Org-Roam-Db-Autosync Override-Global
Pdf-Occur-Global Prescient-Persist Projectile Rainbow-Delimiters
Recentf Selectrum Selectrum-Prescient Shell-Dirtrack Show-Paren
Spell-Fu Tab-Bar Tab-Line Toc-Org Tooltip Transient-Mark Visual-Line
Which-Key Yas Yas-Global

Notes:
1. If I try to auto-complete "/home/" without the "[[ ]]" then
completion works fine.
  


Patch: bug in template expansion in org-fill-template

2022-04-06 Thread Andrew Arensburger
There appears to be a bug in `org-fill-template' (in lisp/org-macs.el): 
keys to be expanded are sorted by increasing length, so that "noweb" is 
processed before "noweb-ref". As a result, if a template includes 
"%noweb-ref", `org-fill-template' will expand it as "%{noweb}-ref" 
rather than "%{noweb-ref}".


As far as I can tell, this bug has existed since `org-fill-template' was 
added, in e8ef16306ca56af2dceb9e2be0b57c930e9b5584 . I tried to trace it 
as back as I could, to see whether there was a good reason for sorting 
keys this way, but couldn't find one.


I'm including a patch with a test to find buggy behavior, and another to 
fix it.
From c52ce631fbc2f8836e10ff41895892839b349da3 Mon Sep 17 00:00:00 2001
From: Andrew Arensburger 
Date: Wed, 6 Apr 2022 14:58:44 -0400
Subject: [PATCH 1/2] test-org-macs.el: Add test for template-expansion bug.

* testing/lisp/test-org-macs.el (ert-deftest test-org/fill-template):
There is a bug in `org-fill-template': it sorts and processes keys in
order of increasing length, so that "noweb" is seen before
"noweb-ref", and "tangle" before "tangle-mode". So in a template that
includes "%noweb-ref", it will substitute the value of "noweb".

This change includes a test for this bug.
---
 testing/lisp/test-org-macs.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/testing/lisp/test-org-macs.el b/testing/lisp/test-org-macs.el
index 6a7ccea3c..c32d891a2 100644
--- a/testing/lisp/test-org-macs.el
+++ b/testing/lisp/test-org-macs.el
@@ -102,7 +102,16 @@
   (should-not
(org-test-with-temp-text "xx abc xx"
  (org-in-regexp "abc" nil t
+
+;;; Template
 
+(ert-deftest test-org/fill-template ()
+  "Test `org-fill-template'"
+  (should
+   (string= "working"
+(org-fill-template "%var-long"
+   '(("var" . "broken")
+ ("var-long" . "working"))
 
 ;;; Time
 
-- 
2.25.1

From ab2ad947bc741ca42700dfa05bb2ce00903f8db8 Mon Sep 17 00:00:00 2001
From: Andrew Arensburger 
Date: Wed, 6 Apr 2022 17:02:19 -0400
Subject: [PATCH 2/2] org-macs.el: Fix template expansion.

* lisp/org-macs.el (org-fill-template): Fix a bug in template
expansion: if one key is a substring of another key (like "noweb" and
"noweb-ref", or "tangle" and "tangle-mode"), the second key wouldn't
get expanded properly.  The problem was that keys were processed in
order of increasing length; they are now sorted in order of descending
length.
---
 lisp/org-macs.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index b39af9103..f85e1f758 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1058,7 +1058,10 @@ as-is if removal failed."
   "Find each %key of ALIST in TEMPLATE and replace it."
   (let ((case-fold-search nil))
 (dolist (entry (sort (copy-sequence alist)
- (lambda (a b) (< (length (car a)) (length (car b))
+ ; Sort from longest key to shortest, so that
+ ; "noweb-ref" and "tangle-mode" get processed
+ ; before "noweb" and "tangle", respectively.
+ (lambda (a b) (< (length (car b)) (length (car a))
   (setq template
 	(replace-regexp-in-string
 	 (concat "%" (regexp-quote (car entry)))
-- 
2.25.1



Re: Removing obsolete function `org-truely-invisible-p'.

2022-04-06 Thread Ihor Radchenko
Karl Fogel  writes:

> Unfortunately, the 'CONTRIBUTE' file at the top level of the Org 
> Mode source tree gives incomplete guidance on commit messages (it 
> just says to follow what Emacs does, so I did that).  I didn't 
> realize that 
> https://orgmode.org/worg/org-contribute.html#commit-messages has 
> further, slightly different guidance.

Could you elaborate?

We have the following in etc/CONTRIBUTE:

>>> * Main contribution rules
>>> ...
>>> See [[https://orgmode.org/worg/org-contribute.html][worg/org-contribute]] 
>>> for guidance on how to contribute effectively.

> A revised patch is attached.  Now it's so simple that I think the 
> commit message doesn't need to point to the mailing list 
> discussion anyway.  Review welcome.

Thanks! Merged as d80aa2776 to main.

Best,
Ihor



Re: [PATCH v2] ol.el: add description format parameter to org-link-parameters

2022-04-06 Thread Ihor Radchenko
Hugo Heagren  writes:

> I've added the condition-case back to the check on
> `org-link-make-description', and added a new one to the check for the
> `:default-description' parameter, as Ihor suggested. I've also
> modified the handling of that parameter, to reflect
> `org-link-make-description', and updated the docstring accordingly.

Thanks!

Some more comments:

> +   (condition-case nil
> +   (let ((def (org-link-get-parameter
> +   type
> +   :default-description)))
> + (cond
> +  ((stringp def) def)
> +  ((functionp def)
> +   (funcall def link desc
> + (error
> +  (message "Can't get link description from %S"
> +(symbol-name def))

Firstly, def will be undefined inside the error clause.

Secondly, when :default-description is a lambda expression and that
expression fails, your code will fail with "wrong-type-argument symbolp"
when executing (symbol-name def). Please consider cases when `def' is
not a string and not a function symbol.

I recommend writing tests for org-insert-link in testing/lisp/test-ol.el
and testing expected behaviour for various values of
:default-description.

> Apologies if the subject formatting is not correct, I'm still getting
> the hang of git-send-email.

You don't have to use git-send-email to submit simple patches. An easier
(as for me) alternative is a simple email with attached patch. magit
makes it trivial to create patch files.

Best,
Ihor