瀏覽代碼

ox.el: Remove .gpg extension from the exported file-name

* ox.el (org-export-output-file-name): Remove .gpg extension.

Reported-by: Adalricus Ovicula <adalricus@inventati.org>
Link: https://orgmode.org/list/87a74x7g6v.fsf@xenon.ovicula/
Bastien Guerry 4 年之前
父節點
當前提交
e8c24b66af
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      lisp/ox.el

+ 6 - 1
lisp/ox.el

@@ -6406,7 +6406,12 @@ When optional argument PUB-DIR is set, use it as the publishing
 directory.
 
 Return file name as a string."
-  (let* ((visited-file (buffer-file-name (buffer-base-buffer)))
+  (let* ((visited-file
+          ;; If a buffer is visiting a .gpg file, remove the .gpg
+          ;; extension from the name of the exported file.
+          (replace-regexp-in-string
+           "\\.gpg\\'" ""
+           (buffer-file-name (buffer-base-buffer))))
 	 (base-name
 	  (concat
 	   (file-name-sans-extension