emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
@ 2014-03-14 23:21 Reuben Thomas
  2014-03-17  2:11 ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Reuben Thomas @ 2014-03-14 23:21 UTC (permalink / raw)
  To: emacs-orgmode



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

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

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

If I customize org-file-apps's system command to be "xdg-open %s", then
customize the default command to be the system command, xdg-open is not
used as the default command, which is confusing; I have to duplicate the
configuration as shown below in order to get the desired behavior, which
seems to contradict the documentation, which says:

                  This command is specified by the entry whose car is `system'.
                  Most likely, the system-specific version of this variable
                  does define this command, but you can overrule/replace it
                  here.

There is a possible ambiguity: maybe for the default command, the value
"system" means "the system default", not the setting for the system
command? (That would seem unfortunate and confusing were it the case.)

Emacs  : GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-07-27 on roseapple, modified by Debian
Package: Org-mode version 8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)

current state:
==============
(setq
 org-export-backends '(ascii html icalendar latex odt)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default) (t . "xdg-open %s") (system . "xdg-open %s"))
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-default-notes-file "~/org/Notes.org"
 org-startup-indented t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-odt-format-headline-function 'ignore
 org-from-is-user-regexp "\\<Reuben Thomas\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(window-margin-mode #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec
                 org-babel-hide-all-hashes turn-on-eldoc-mode)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-odt-format-inlinetask-function 'ignore
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-hide-inline-tasks org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-odt-format-drawer-function '(lambda (name contents) contents)
 org-html-format-headline-function 'ignore
 org-html-format-inlinetask-function 'ignore
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )
-- 
http://rrt.sc3d.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-03-14 23:21 Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)] Reuben Thomas
@ 2014-03-17  2:11 ` Bastien
  2014-03-17 12:18   ` Reuben Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-17  2:11 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: emacs-orgmode

Hi Reuben,

I'm confused and can't get what's the problem: is it a bug?
Is it a documentation bug?  Can you provide a minimal recipe
(if this is a bug) or a patch against the documentation?

Thanks in advance,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-03-17  2:11 ` Bastien
@ 2014-03-17 12:18   ` Reuben Thomas
  2014-03-17 12:37     ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Reuben Thomas @ 2014-03-17 12:18 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On 17 March 2014 02:11, Bastien <bzg@gnu.org> wrote:

> Hi Reuben,
>
> I'm confused and can't get what's the problem: is it a bug?
> Is it a documentation bug?


I don't know, because I don't know whether it's the behavior or
documentation that is wrong.

-- 
http://rrt.sc3d.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-03-17 12:18   ` Reuben Thomas
@ 2014-03-17 12:37     ` Bastien
  2014-03-17 13:17       ` Reuben Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-17 12:37 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: emacs-orgmode

Reuben Thomas <rrt@sc3d.org> writes:

> I don't know, because I don't know whether it's the behavior or
> documentation that is wrong.

If the behavior is wrong, what is wrong?

If the documentation is wrong, what is wrong?

Sorry to be plain, but you need to help me :)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-03-17 12:37     ` Bastien
@ 2014-03-17 13:17       ` Reuben Thomas
  2014-04-21 19:00         ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Reuben Thomas @ 2014-03-17 13:17 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On 17 March 2014 12:37, Bastien <bzg@gnu.org> wrote:

> Reuben Thomas <rrt@sc3d.org> writes:
>
> > I don't know, because I don't know whether it's the behavior or
> > documentation that is wrong.
>
> If the behavior is wrong, what is wrong?
>
> If the documentation is wrong, what is wrong?
>

I shall assume it's a bug in the code.

0. The docstring for org-file-apps for the "system" command says:

                  This command is specified by the entry whose car is
`system'.
                  Most likely, the system-specific version of this variable
                  does define this command, but you can overrule/replace it
                  here.

1. I customize org-file-apps's system command to be "xdg-open %s", then
customize the default command to be the system command.

2. Now I try opening a file type which uses the default command.

Expected result: xdg-open should be used.

Actual result: the file is opened in Emacs (it's a PDF file, xdg-open would
open it in evince).

If I explicitly customize the default command also to be "xdg-open", then I
get the expected result.

-- 
http://rrt.sc3d.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-03-17 13:17       ` Reuben Thomas
@ 2014-04-21 19:00         ` Bastien
  2014-04-23 13:29           ` Reuben Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-04-21 19:00 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: emacs-orgmode

Hi Reuben,

Reuben Thomas <rrt@sc3d.org> writes:

> 1. I customize org-file-apps's system command to be "xdg-open %s",
> then customize the default command to be the system command.

Please share the value of `org-file-apps' (C-h v org-file-apps RET).

What I've found is that, since .pdf documents can be opened in Emacs
and since org-file-apps contains (auto-mode . emacs) as its first
element, then changing the system's value to xdg-open after that will
fail because (auto-mode . emacs) is applied first.

Sure, the docstring needs a bit of simplification, thought.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-04-21 19:00         ` Bastien
@ 2014-04-23 13:29           ` Reuben Thomas
  2014-04-23 15:04             ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Reuben Thomas @ 2014-04-23 13:29 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On 21 April 2014 20:00, Bastien <bzg@gnu.org> wrote:

> Hi Reuben,
>
> Reuben Thomas <rrt@sc3d.org> writes:
>
> > 1. I customize org-file-apps's system command to be "xdg-open %s",
> > then customize the default command to be the system command.
>
> Please share the value of `org-file-apps' (C-h v org-file-apps RET).
>

Value: ((auto-mode . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default)
 (t . "xdg-open %s")
 (system . "xdg-open %s"))


> What I've found is that, since .pdf documents can be opened in Emacs
> and since org-file-apps contains (auto-mode . emacs) as its first
> element, then changing the system's value to xdg-open after that will
> fail because (auto-mode . emacs) is applied first.
>

That's interesting, but I'm no less confused. With the value above, PDF
files *are* opened with xdg-open.


> Sure, the docstring needs a bit of simplification, thought.
>

That would be a good start: if I can understand what is supposed to happen,
I have some chance to tell whether the actual behaviour is correct or not!

Thanks for your continued attention to this issue.

-- 
http://rrt.sc3d.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-04-23 13:29           ` Reuben Thomas
@ 2014-04-23 15:04             ` Bastien
  2014-04-27 13:54               ` Reuben Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-04-23 15:04 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: emacs-orgmode

Hi Reuben,

Reuben Thomas <rrt@sc3d.org> writes:

> Value: ((auto-mode . emacs)
>  ("\\.mm\\'" . default)
>  ("\\.x?html?\\'" . default)
>  ("\\.pdf\\'" . default)
>  (t . "xdg-open %s")
>  (system . "xdg-open %s"))
>  
>
>     What I've found is that, since .pdf documents can be opened in
>     Emacs
>     and since org-file-apps contains (auto-mode . emacs) as its first
>     element, then changing the system's value to xdg-open after that
>     will
>     fail because (auto-mode . emacs) is applied first.
>
>
> That's interesting, but I'm no less confused. With the value above,
> PDF files *are* opened with xdg-open.

Okay, see those two bits of `org-file-apps' docstring:

`auto-mode'    Matches files that are matched by any entry in `auto-mode-alist',
               so all files Emacs knows how to handle.  Using this with
               command `emacs' will open most files in Emacs.  Beware that this
               will also open html files inside Emacs, unless you add
               ("html" . default) to the list as well.
               
So (auto-mode . emacs) says to open .pdf files in emacs... but 
("\\.pdf\\'" . default) says to open .pdf files using the "default"
application:

 `default'     Use the default application for this file type, which is the
               association for t in the list

Since you have (t . "xdg-open %s"), xdg-open is used.

Yep, it's all a bit tricky...

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)]
  2014-04-23 15:04             ` Bastien
@ 2014-04-27 13:54               ` Reuben Thomas
  0 siblings, 0 replies; 9+ messages in thread
From: Reuben Thomas @ 2014-04-27 13:54 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On 23 April 2014 16:04, Bastien <bzg@gnu.org> wrote:

> Okay, see those two bits of `org-file-apps' docstring:
>
> `auto-mode'    Matches files that are matched by any entry in
> `auto-mode-alist',
>                so all files Emacs knows how to handle.  Using this with
>                command `emacs' will open most files in Emacs.  Beware that
> this
>                will also open html files inside Emacs, unless you add
>                ("html" . default) to the list as well.
>
> So (auto-mode . emacs) says to open .pdf files in emacs... but
> ("\\.pdf\\'" . default) says to open .pdf files using the "default"
> application:
>
>  `default'     Use the default application for this file type, which is the
>                association for t in the list
>
> Since you have (t . "xdg-open %s"), xdg-open is used.
>
> Yep, it's all a bit tricky...
>

Thanks for explaining more. The reason I was (and remain!) still confused
is that you said earlier that because "auto-mode" comes first, it is not
overridden by changing the default value later. So the implication is that
changing the default value does not override other values, but changing the
system value does. Am I correct?

-- 
http://rrt.sc3d.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-04-27 13:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-14 23:21 Bug: Setting system command org-file-apps does not allow other settings to refer to it [8.2.5h (release_8.2.5h-620-g7fd183 @ /home/rrt/.emacs.d/el-get/package/elpa/org-20140210/)] Reuben Thomas
2014-03-17  2:11 ` Bastien
2014-03-17 12:18   ` Reuben Thomas
2014-03-17 12:37     ` Bastien
2014-03-17 13:17       ` Reuben Thomas
2014-04-21 19:00         ` Bastien
2014-04-23 13:29           ` Reuben Thomas
2014-04-23 15:04             ` Bastien
2014-04-27 13:54               ` Reuben Thomas

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).