emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Craig STCR <craig.stcr1@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Bug in 9.5.3 org--file-default-apps
Date: Mon, 16 May 2022 08:38:14 -0400	[thread overview]
Message-ID: <de2b87c1-760e-f47a-575f-3c4abc590fbc@gmail.com> (raw)
In-Reply-To: <e9b4e88d-3807-9080-fa86-c297b17794cb@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4426 bytes --]

[ With 'Reply All' ]

Here's a summary of what I currently observe:

1)  I was mistaken about the change from 9.5.2 to 9.5.3.  You are 
correct.  As you noted, the 9.5.2, 9.5.3 diff I previously mentioned was 
erroneous.

2) The problem I encounter with both 9.5.2 and 9.5.3 is that when 
opening a shell script -- no file extension, e.g. /home/user/myscript -- 
mailcap should be consulted and org should open the script file in 
Emacs.  The mailcap entry is:

    application/x-shellscript; emacs27 %s; test=test -n "$DISPLAY"

But instead, org opens the script file using /bin/less, not emacs.

3) The misbehavior in #2 is new.  I don't know exactly when it started 
misbehaving but I suspect it happened after updating org to 9.5.3.  But 
other packages -- elpa, emacs binaries, OS binaries -- may have been 
updated at the same time, or before that, or after that, so hard to pin 
it down.  I can't even say for sure if the upgrade to org 9.5.3 was from 
org 9.5.2.  It may have been an upgrade from an org version older than 
9.5.2.

4) Throughout this discussion, when I say "org opens" I am referring to 
the key sequence "C-c C-o" bound to org-open-at-point.  It opens script 
file with /bin/less, which is not what I would expect. <mouse-1>, bound 
to org-open-at-mouse (which calls org-open-file?) has the same misbehavior.

5) <mouse-3>, bound to org-find-file-at-mouse, *works as expected* and 
opens the script file in emacs.  Also, using a single prefix argument, 
"C-u C-c C-o" *works as expected* and opens the script file in emacs.

6) Last but not lease, when I *manually edit* org.el and change the last 
line of the org--file-default-apps function definition, removing 
underscore and space, and replacing with single quote like this:

    diff

        8701c8700
        <     (_ org-file-apps-gnu)))
        ---
         > ('org-file-apps-gnu)))

I no longer observe the misbehavior described in #2 and #4. Instead, org 
*works as expected*, like it does with #5, and opens the script file in 
emacs, not /bin/less.

I know your time is valuable.  No need for you to spend a lot of time on 
this if I am the only one having this problem.  It could be some random 
artifact in my installation, maybe something in my ~/.emacs.  My 
~/.emacs has a lot in it.  And I have a work-around, since I can use #5.

Best wishes,
-C

On 5/16/22 6:29 AM, Craig STCR wrote:
> It's possible my elpa is FUBAR.  I will uninstall, rm .elc, 
> re-install, and re-compile org 9.5.3 when I get a chance.
>
> On 5/16/22 6:08 AM, Craig STCR wrote:
>> OK, I'll take a look as you suggested as soon as I can.
>>
>> So the form in 9.5.2 was a bug?
>>
>> The problem I encounter with the new form in 9.5.3 is that when 
>> opening a shell script -- no file extension, e.g. /home/user/myscript 
>> -- 9.5.2 would consult mailcap and open the script in Emacs.  The 
>> mailcap entry is:
>>
>>     application/x-shellscript; emacs27 %s; test=test -n "$DISPLAY"
>>
>> But with the new form in 9.5.3, /home/user/myscript is opened by 
>> /bin/less, not emacs.  I assume mailcap is not consulted.  Which does 
>> not work well.  These behaviors are only for org.  Outside of org, 
>> emacs behaves correctly.
>>
>> I'll take a look as you suggested as soon as I can.
>>
>> Thanks, Ihor.
>>
>>
>> On 5/16/22 4:33 AM, Ihor Radchenko wrote:
>>> Craig STCR<craig.stcr1@gmail.com>  writes:
>>>
>>>> 9.5.3 does not return org-file-apps-gnu because org-file-apps-gnu is not
>>>> quoted.  Should be (and was in 9.5.2):
>>>>
>>>>      'org-file-apps-gnu
>>>>
>>>> but in 9.5.3 it is:
>>>>
>>>>      _ org-file-apps-gnu
>>> Please try to run the following form:
>>>
>>> (pcase 'gnu/linux
>>>      (`darwin org-file-apps-macos)
>>>      (`windows-nt org-file-apps-windowsnt)
>>>      ('org-file-apps-gnu)) ;; => nil
>>>     
>>> and then
>>>
>>> (pcase 'gnu/linux
>>>      (`darwin org-file-apps-macos)
>>>      (`windows-nt org-file-apps-windowsnt)
>>>      (_ org-file-apps-gnu)) ;; => ((remote . emacs) (system . mailcap) (t . mailcap))
>>>
>>> The second case is returning a list, which org--file-default-apps
>>> supposed to return. The previous behaviour was erroneous. You may refer
>>> to M-x describe-function <RET> pcase <RET> to understand the code.
>>>
>>> Please, provide more details on the actual error you ran into. The
>>> change in the org--file-default-apps is not a bug.
>>>
>>> Best,
>>> Ihor
>>>
>>
>

[-- Attachment #2: Type: text/html, Size: 6228 bytes --]

  parent reply	other threads:[~2022-05-16 13:16 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 16:49 Bug in 9.5.3 org--file-default-apps Craig STCR
2022-05-16  4:53 ` Ihor Radchenko
     [not found]   ` <6615610d-93ae-171f-b554-3f4cc79354cc@gmail.com>
2022-05-16  8:33     ` Ihor Radchenko
     [not found]       ` <86692975-4d5f-6933-3227-c6b208f76862@gmail.com>
2022-05-16 11:57         ` Ihor Radchenko
2022-05-16 15:14           ` Max Nikulin
2022-05-16 19:15             ` Craig STCR
2022-05-16 19:29             ` Craig STCR
2022-05-17 16:03               ` Max Nikulin
2022-05-18 11:36             ` Ihor Radchenko
2022-05-18 16:10               ` Max Nikulin
2022-05-19 13:39                 ` Ihor Radchenko
2022-05-19 14:45                   ` Max Nikulin
2022-05-20  8:22                     ` Ihor Radchenko
2022-05-20 11:31                       ` Max Nikulin
2022-05-21  1:44                         ` Ihor Radchenko
2022-05-21 14:56                           ` Max Nikulin
2022-05-22  4:10                             ` [PATCH] " Ihor Radchenko
2022-05-22  7:40                               ` Max Nikulin
2022-05-26  4:23                                 ` [PATCH v2] " Ihor Radchenko
2022-05-29  6:07                                   ` Max Nikulin
2022-05-30 14:00                                     ` [PATCH v3] " Ihor Radchenko
2022-05-30 15:38                                       ` Max Nikulin
2022-05-31 15:07                                         ` Max Nikulin
2022-06-04 13:42                                         ` [DISCUSSION, default settings] Using mailcap as default handler for opening file links (was: [PATCH v3] Re: Bug in 9.5.3 org--file-default-apps) Ihor Radchenko
2022-06-04 17:01                                           ` Greg Minshall
2022-06-06 12:50                                           ` [DISCUSSION, default settings] Using mailcap as default handler for opening file links Max Nikulin
2022-06-06 15:22                                             ` Max Nikulin
2022-06-06 17:47                                             ` Bhavin Gandhi
2022-06-10 16:38                                               ` Max Nikulin
2024-02-12 12:36                                             ` Ihor Radchenko
2024-02-13 10:59                                               ` Max Nikulin
2024-02-13 11:27                                                 ` Ihor Radchenko
2024-02-13 15:44                                                   ` Max Nikulin
2024-02-13 15:47                                                     ` Max Nikulin
2024-02-14 14:51                                                     ` Ihor Radchenko
2024-02-27 10:43                                                       ` Max Nikulin
2022-05-29  7:07                                   ` [PATCH v2] Re: Bug in 9.5.3 org--file-default-apps Max Nikulin
2022-05-23 12:40                           ` Craig STCR
2022-05-23 12:59                             ` Craig STCR
2022-05-23 14:14                               ` Craig STCR
2022-05-23 14:32                                 ` Craig STCR
2022-05-25  6:18                               ` Ihor Radchenko
2022-05-23 15:28                             ` Max Nikulin
2022-05-25  6:24                               ` Ihor Radchenko
2022-05-25 11:38                                 ` Craig STCR
2022-05-25  6:10                             ` Ihor Radchenko
     [not found]         ` <e9b4e88d-3807-9080-fa86-c297b17794cb@gmail.com>
2022-05-16 12:38           ` Craig STCR [this message]
2022-05-18 11:38             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de2b87c1-760e-f47a-575f-3c4abc590fbc@gmail.com \
    --to=craig.stcr1@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).