emacs组织模式导出odt文件,但使用PDF查看器打开
出于某种原因,组织模式正确地导出到ODT文件,但使用默认的PDF查看器(okular)而不是libreoffice打开它。我尝试过类似案例中提到的所有解决方案,但没有任何运气。为了便于参考,我在下面复制了init文件的相关部分。我的emacs是27.0.50,我的组织模式是9.1.13emacs组织模式导出odt文件,但使用PDF查看器打开,emacs,org-mode,odt,okular,Emacs,Org Mode,Odt,Okular,出于某种原因,组织模式正确地导出到ODT文件,但使用默认的PDF查看器(okular)而不是libreoffice打开它。我尝试过类似案例中提到的所有解决方案,但没有任何运气。为了便于参考,我在下面复制了init文件的相关部分。我的emacs是27.0.50,我的组织模式是9.1.13 ;; Enable export in ODT format (eval-after-load "org" '(require 'ox-odt nil t)) ; enable odt backend ;; Op
;; Enable export in ODT format
(eval-after-load "org" '(require 'ox-odt nil t)) ; enable odt backend
;; Open ODT files with libre office
(defun my-org-export-to-odt-and-open ()
(interactive)
(org-open-file (org-odt-export-to-odt)))
在我的自定义变量集中
'(org-file-apps
'((auto-mode . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.odt\\'" . "libreoffice %s")
("\\.pdf\\'" . "okular %s")))
提前感谢您的帮助
这是组织文件应用程序的输出值
Value:
((auto-mode . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.odt\\'" . "libreoffice %s")
("\\.pdf\\'" . "okular %s"))
Original value was
((auto-mode . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . default))
这是我试图导出NOTES.org文件时,edebug在org open file
上的一个输出
Debugger entered--returning value: nil
string-match("\\$\\(?:\\(?1:[[:alnum:]_]+\\)\\|{\\(?1:[^{}]+\\)}\\|\\$\\)" "/home/andre/org/NOTES.odt" 0)
* substitute-env-vars("/home/andre/org/NOTES.odt" t)
* substitute-env-in-file-name("/home/andre/org/NOTES.odt")
* substitute-in-file-name("/home/andre/org/NOTES.odt")
* #f(compiled-function (path &optional in-emacs line search) "Open the file at PATH.\nFirst, this expands any special file name abbreviations. Then the\nconfiguration variable `org-file-apps' is checked if it contains an\nentry for this file type, and if yes, the corresponding command is launched.\n\nIf no application is found, Emacs simply visits the file.\n\nWith optional prefix argument IN-EMACS, Emacs will visit the file.\nWith a double \\[universal-argument] \\[universal-argument] prefix arg, Org tries to avoid opening in Emacs\nand to use an external application to visit the file.\n\nOptional LINE specifies a line to go to, optional SEARCH a string\nto search for. If LINE or SEARCH is given, the file will be\nopened in Emacs, unless an entry from org-file-apps that makes\nuse of groups in a regexp matches.\n\nIf you want to change the way frames are used when following a\nlink, please customize `org-link-frame-setup'.\n\nIf the file does not exist, an error is thrown." #<bytecode 0x1524219>)("NOTES.odt" system)
* apply(#f(compiled-function (path &optional in-emacs line search) "Open the file at PATH.\nFirst, this expands any special file name abbreviations. Then the\nconfiguration variable `org-file-apps' is checked if it contains an\nentry for this file type, and if yes, the corresponding command is launched.\n\nIf no application is found, Emacs simply visits the file.\n\nWith optional prefix argument IN-EMACS, Emacs will visit the file.\nWith a double \\[universal-argument] \\[universal-argument] prefix arg, Org tries to avoid opening in Emacs\nand to use an external application to visit the file.\n\nOptional LINE specifies a line to go to, optional SEARCH a string\nto search for. If LINE or SEARCH is given, the file will be\nopened in Emacs, unless an entry from org-file-apps that makes\nuse of groups in a regexp matches.\n\nIf you want to change the way frames are used when following a\nlink, please customize `org-link-frame-setup'.\n\nIf the file does not exist, an error is thrown." #<bytecode 0x1524219>) ("NOTES.odt" system))
* org-open-file("NOTES.odt" system)
(if a (org-odt-export-to-odt t s v) (org-open-file (org-odt-export-to-odt nil s v) 'system))
(lambda (a s v b) (if a (org-odt-export-to-odt t s v) (org-open-file (org-odt-export-to-odt nil s v) 'system)))(nil t nil nil)
org-export-dispatch(nil)
funcall-interactively(org-export-dispatch nil)
call-interactively(org-export-dispatch nil nil)
command-execute(org-export-dispatch)
事实上,我一直在前进,在org文件应用程序中没有任何选项可以与之匹敌。经过大量挖掘,我发现了以下帖子: 由此产生了以下解决方案:
;; Enable export in ODT format
(setcdr (assq 'system org-file-apps-defaults-gnu ) "xdg-open %s")
(setq process-connection-type nil)
没有在组织文件应用程序上配置任何内容。首先确保您正在运行的emacs中设置了
org file apps
:C-h v org file apps RET说什么?如果不包括odt设置,则不使用自定义文件。如果它确实包含odt设置,我将在org open file
上使用它来查看出错的地方。@NickD很抱歉回复得太晚,感谢您的帮助。我将把组织文件apps
和组织打开文件
的输出放在上面。由于我不是一个非常有经验的lisp用户,我可能需要一些帮助来解释它。
;; Enable export in ODT format
(setcdr (assq 'system org-file-apps-defaults-gnu ) "xdg-open %s")
(setq process-connection-type nil)