summaryrefslogtreecommitdiff
path: root/lisp/filesets.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/filesets.el')
-rw-r--r--lisp/filesets.el80
1 files changed, 28 insertions, 52 deletions
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 0b97bd4c518..68133ba2255 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -161,18 +161,9 @@ COND-FN takes one argument: the current element."
(define-obsolete-function-alias 'filesets-member #'cl-member "28.1")
(define-obsolete-function-alias 'filesets-sublist #'seq-subseq "28.1")
-(defun filesets-select-command (cmd-list)
- "Select one command from CMD-LIST -- a string with space separated names."
- (let ((this (shell-command-to-string
- (format "which --skip-alias %s 2> %s | head -n 1"
- cmd-list null-device))))
- (if (equal this "")
- nil
- (file-name-nondirectory (substring this 0 (- (length this) 1))))))
-
(defun filesets-which-command (cmd)
"Call \"which CMD\"."
- (shell-command-to-string (format "which %s" cmd)))
+ (shell-command-to-string (format "which %s" (shell-quote-argument cmd))))
(defun filesets-which-command-p (cmd)
"Call \"which CMD\" and return non-nil if the command was found."
@@ -286,7 +277,7 @@ See `easy-menu-add-item' for documentation."
)
(defcustom filesets-menu-in-menu nil
- "Use that instead of `current-menubar' as the menu to change.
+ "Use that instead of `current-global-map' as the menu to change.
See `easy-menu-add-item' for documentation."
:set #'filesets-set-default
:type 'sexp)
@@ -413,15 +404,14 @@ directory's name.
Note: You have to manually rebuild the menu if you change this value."
:set #'filesets-set-default
- :type '(choice :tag "Function:"
+ :type '(choice :tag "Function"
(const :tag "dired"
:value dired)
(list :tag "Command"
:value ("" "%s")
(string :tag "Name")
(string :tag "Arguments"))
- (function :tag "Function"
- :value nil)))
+ (function :tag "Function")))
(defcustom filesets-open-file-function #'filesets-find-or-display-file
"The function used for opening files.
@@ -437,23 +427,21 @@ readable, will not be opened.
Caveat: Changes will take effect only after rebuilding the menu."
:set #'filesets-set-default
- :type '(choice :tag "Function:"
+ :type '(choice :tag "Function"
(const :tag "filesets-find-or-display-file"
:value filesets-find-or-display-file)
(const :tag "filesets-find-file"
:value filesets-find-file)
- (function :tag "Function"
- :value nil)))
+ (function :tag "Function")))
(defcustom filesets-save-buffer-function #'save-buffer
"The function used to save a buffer.
Caveat: Changes will take effect after rebuilding the menu."
:set #'filesets-set-default
- :type '(choice :tag "Function:"
+ :type '(choice :tag "Function"
(const :tag "save-buffer"
:value save-buffer)
- (function :tag "Function"
- :value nil)))
+ (function :tag "Function")))
(defcustom filesets-find-file-delay
(if (and (featurep 'xemacs) gutter-buffers-tab-visible-p)
@@ -535,7 +523,7 @@ the filename."
:type '(repeat :tag "Commands"
(list :tag "Definition" :value ("")
(string "Name")
- (choice :tag "Command"
+ (choice :tag "Command" :value ""
(string :tag "String")
(function :tag "Function"))
(repeat :tag "Argument List"
@@ -546,21 +534,10 @@ the filename."
:value "<file-name>")
(string :tag "Quoted File Name"
:value "<<file-name>>")
- (function :tag "Function"
- :value nil))))))
+ (function :tag "Function"))))))
(defcustom filesets-external-viewers
(let
- ;; ((ps-cmd (or (and (boundp 'my-ps-viewer) my-ps-viewer)
- ;; (filesets-select-command "ggv gv")))
- ;; (pdf-cmd (or (and (boundp 'my-ps-viewer) my-pdf-viewer)
- ;; (filesets-select-command "xpdf acroread")))
- ;; (dvi-cmd (or (and (boundp 'my-ps-viewer) my-dvi-viewer)
- ;; (filesets-select-command "xdvi tkdvi")))
- ;; (doc-cmd (or (and (boundp 'my-ps-viewer) my-doc-viewer)
- ;; (filesets-select-command "antiword")))
- ;; (pic-cmd (or (and (boundp 'my-ps-viewer) my-pic-viewer)
- ;; (filesets-select-command "gqview ee display"))))
((ps-cmd "ggv")
(pdf-cmd "xpdf")
(dvi-cmd "xdvi")
@@ -647,12 +624,12 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these:
(repeat :tag "Properties"
(choice
(list :tag ":constraintp"
- :value (:constraintp)
+ :value (:constraintp ignore)
(const :format ""
:value :constraintp)
(function :tag "Function"))
(list :tag ":constraint-flag (obsolete)"
- :value (:constraint-flag)
+ :value (:constraint-flag nil)
(const :format ""
:value :constraint-flag)
(sexp :tag "Symbol"))
@@ -667,7 +644,7 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these:
:value :ignore-on-read-text)
(boolean :tag "Boolean"))
(list :tag ":args"
- :value (:args)
+ :value (:args nil)
(const :format ""
:value :args)
(repeat :tag "List"
@@ -676,10 +653,9 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these:
:value "")
(symbol :tag "Symbol"
:value nil)
- (function :tag "Function"
- :value nil))))
+ (function :tag "Function"))))
(list :tag ":open-hook"
- :value (:open-hook)
+ :value (:open-hook nil)
(const :format ""
:value :open-hook)
(hook :tag "Hook"))
@@ -1089,10 +1065,6 @@ Return full path if FULL-FLAG is non-nil."
(t
(error "Filesets: %s does not exist" dir))))
-(defun filesets-quote (txt)
- "Return TXT in quotes."
- (concat "\"" txt "\""))
-
(defun filesets-get-selection ()
"Get the text between mark and point -- i.e. the selection or region."
(let ((m (mark))
@@ -1103,7 +1075,7 @@ Return full path if FULL-FLAG is non-nil."
(defun filesets-get-quoted-selection ()
"Return the currently selected text in quotes."
- (filesets-quote (filesets-get-selection)))
+ (shell-quote-argument (filesets-get-selection)))
(defun filesets-get-shortcut (n)
"Create menu shortcuts based on number N."
@@ -1250,12 +1222,13 @@ Use the viewer defined in EV-ENTRY (a valid element of
(if fmt
(mapconcat
(lambda (this)
- (if (stringp this) (format this file)
- (format "%S" (if (functionp this)
- (funcall this)
- this))))
+ (if (stringp this)
+ (format this (shell-quote-argument file))
+ (shell-quote-argument (if (functionp this)
+ (funcall this)
+ this))))
fmt "")
- (format "%S" file))))
+ (shell-quote-argument file))))
(output
(cond
((and (functionp vwr) co-flag)
@@ -1264,7 +1237,7 @@ Use the viewer defined in EV-ENTRY (a valid element of
(funcall vwr file)
nil)
(co-flag
- (shell-command-to-string (format "%s %s" vwr args)))
+ (shell-command-to-string (format "%s %s" vwr args)))
(t
(shell-command (format "%s %s&" vwr args))
nil))))
@@ -1772,7 +1745,7 @@ If no fileset name is provided, prompt for NAME."
(add-to-list 'filesets-data (list name '(:files)))
(message
(substitute-command-keys
- "Fileset %s created. Call `\\[filesets-save-config]' to save.")
+ "Fileset %s created. Call \\[filesets-save-config] to save.")
name)
(car filesets-data))))))
(if entry
@@ -1817,7 +1790,6 @@ If no fileset name is provided, prompt for NAME."
(defun filesets-convert-patterns (name)
"Change fileset NAME's mode from :pattern to :files."
- (interactive)
(let ((entry (assoc name filesets-data)))
(if entry
(let ((pattern (filesets-entry-get-pattern entry))
@@ -2489,11 +2461,15 @@ Set up hooks, load the cache file -- if existing -- and build the menu."
(setq filesets-menu-use-cached-flag t)))
(filesets-build-menu)))
+;;; obsolete
+
(defun filesets-error (_class &rest args)
"`error' wrapper."
(declare (obsolete error "28.1"))
(error "%s" (mapconcat #'identity args " ")))
+(define-obsolete-function-alias 'filesets-quote #'shell-quote-argument "30.1")
+
(provide 'filesets)
;;; filesets.el ends here