Hi Markus, hi everybody,
Thanks a lot for your previous informations.
So I change muse syntax and now I can open all files I want with evince
(for *.pdf) libreoffice (for *.odt) nautilus (for directory) idle3 (for
Python) and so.
You can be surprise I open *.py file with idle and not with python-mode
in emacs but this change is in fact for my son who wants to link and
comments various kinds of files, and he discorvers emacs last week.
Without your help, I never discover how I can do this. I copy the change
I add in my .emacs file.
Best Regards from France.
F.
;;;
;;; -------- only one line to change : local-muse-shell-protocols.
;;; local-muse-shell-protocol is the lists of shell-protocols, ie the
name of the launcher is the name of an existing file
;;; The link [[evince:thisFile.pdf]] runs in background evince thisFile.pdf.
;;;
(autoload 'muse "muse")
(setq local-muse-shell-protocols '("evince")) # add all the label you
want to use, "libreoffice", "idle3", and so.
(load "muse-protocols")
(load "muse-colors")
(defun local-muse-command-protocol (str) #
extract the protocol from the parameter str (=link in muse-mode code)
(let ((tmp (string-match ":" str)))
(if tmp (substring str 0 tmp) "")))
(defun local-muse-shell-protocolp (str) # test if the protocol
string is in the predefined list local-muse-shell-protocol
(member (local-muse-command-protocol str) local-muse-shell-protocols))
(defun local-muse-test-local-filename (str) # choose the color for a
file : is it really a existing local file
(if (file-exists-p str) 'muse-link 'muse-bad-link))
(defun local-muse-filename
(str) # extract the filename
from the link
(let ((tmp (string-match ":" str)))
(if tmp (substring str (1+ tmp)) str)))
(defun local-muse-run-background (str)
# run the command in background
(start-process-shell-command "*Muse process*" "*Muse process*"
(concat (local-muse-command-protocol str) " " (local-muse-filename
str))))
(defun muse-link-face (link-name &optional explicit) # the only
copy/cut from source file
"Return the type of LINK-NAME as a face symbol.
For EXPLICIT links, this is either a normal link or a bad-link
face. For implicit links, it is either colored normally or
ignored."
(when link
(cond ((and (string-match muse-url-regexp link) #
change in order to accept command:localExistingFile
(local-muse-shell-protocolp
link)) # This first cond in 4 lines
(local-muse-test-local-filename #
(local-muse-filename
link))) #
((string-match muse-url-regexp link) 'muse-link)
((muse-file-remote-p link)
'muse-link)
((string-match muse-file-regexp link)
(when (string-match "/[^/]+#[^#./]+\\'" link)
;; strip anchor from the end of a path
(setq link (substring link 0 (match-beginning 0))))
(if (file-exists-p link)
'muse-link
'muse-bad-link))
((not (featurep 'muse-project))
'muse-link)
(t
(if (string-match "#" link)
(setq link (substring link 0 (match-beginning 0))))
(if (or (and (muse-project-of-file)
(muse-project-page-file
(if (or (and (muse-project-of-file)
(muse-project-page-file
link muse-current-project t))
(file-exists-p link))
'muse-link
'muse-bad-link)))))))
(mapcar (lambda (x)(muse-protocol-add x 'local-muse-run-background
'identity))
local-muse-shell-protocols)
;;;
;;; ------------------------------ Modifications pour Muse : fin
;;;
_______________________________________________
Muse-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/muse-el-discuss