[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/muse a1577f6f27 02/14: correct filename generation for
From: |
Stefan Monnier |
Subject: |
[elpa] externals/muse a1577f6f27 02/14: correct filename generation for not-yet-existing links |
Date: |
Fri, 9 Feb 2024 18:40:43 -0500 (EST) |
branch: externals/muse
commit a1577f6f27edb38388352e9567962d3090a1c469
Author: Alex Ott <alexott@gmail.com>
Commit: Alex Ott <alexott@gmail.com>
correct filename generation for not-yet-existing links
behaviour now is same for both files included into project and not
---
lisp/muse-mode.el | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el
index 3516d7b09a..79e528a8b1 100644
--- a/lisp/muse-mode.el
+++ b/lisp/muse-mode.el
@@ -563,6 +563,20 @@ Do not rename the page originally referred to."
t t))
(error "There is no valid link at point")))
+(defun muse-get-link-filename (link)
+ "Generates correct file name for given link, when source file doesn't belong
to any
+project. Creates directory if link contains directory part, and it doesn't
exists"
+ (let ((directory (file-name-directory link))
+ (filename (file-name-nondirectory link)))
+ (when (and (not (file-name-extension filename))
+ muse-file-extension
+ (not (string= muse-file-extension ""))
+ (not (file-exists-p link)))
+ (setq filename (concat filename "." muse-file-extension)))
+ (when (and directory (not (file-exists-p directory)))
+ (make-directory directory t))
+ (expand-file-name filename directory)))
+
(defun muse-visit-link-default (link &optional other-window)
"Visit the URL or link named by LINK.
If ANCHOR is specified, search for it after opening LINK.
@@ -595,8 +609,8 @@ in `muse-project-alist'."
(and other-window
'find-file-other-window))
(if other-window
- (find-file-other-window link)
- (find-file link))))))
+ (find-file-other-window (muse-get-link-filename link))
+ (find-file (muse-get-link-filename link)))))))
(when anchor
(let ((pos (point))
(regexp (concat "^\\W*" (regexp-quote anchor) "\\b"))
- [elpa] externals/muse updated (be347db7f1 -> 8710adde8f), Stefan Monnier, 2024/02/09
- [elpa] externals/muse 517cf75cc4 05/14: Merge pull request #2 from cocoatomo/master, Stefan Monnier, 2024/02/09
- [elpa] externals/muse fdc56d1611 06/14: Update lisp/muse-texinfo.el, Stefan Monnier, 2024/02/09
- [elpa] externals/muse a8458264ec 08/14: Fix comment regexp, Stefan Monnier, 2024/02/09
- [elpa] externals/muse faa48d78ed 09/14: Merge pull request #9 from labdsf/master, Stefan Monnier, 2024/02/09
- [elpa] externals/muse eb866abb55 10/14: Migrate away from deprecated assoc.el. (#14), Stefan Monnier, 2024/02/09
- [elpa] externals/muse a1577f6f27 02/14: correct filename generation for not-yet-existing links,
Stefan Monnier <=
- [elpa] externals/muse b22338147e 11/14: convert a muse-init.el example to UTF-8 (#15), Stefan Monnier, 2024/02/09
- [elpa] externals/muse f0bdba2edb 01/14: use correct newline character in longlines-mode, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 20fc8575d5 13/14: Merge remote-tracking branch 'upstream/muse/main' into externals/muse, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 8710adde8f 14/14: Fix compilation and address some warnings, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 92922b23d3 03/14: make new behaviour configurable, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 0b082f614c 04/14: translated QuickStart into Japanese, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 0bb5d3fa57 07/14: Merge pull request #4 from thesoftwarebin/patch-1, Stefan Monnier, 2024/02/09
- [elpa] externals/muse 8b1cbac200 12/14: Move files back, Stefan Monnier, 2024/02/09