summaryrefslogtreecommitdiff
path: root/lisp/xdg.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2017-09-09 00:46:41 -0400
committerMark Oteiza <mvoteiza@udel.edu>2017-09-09 00:46:41 -0400
commitbe9bc8e67d6caf6d61fe4f46ac5b640ada16ba95 (patch)
tree4042d8c5def741ddf3397925bfd213f2efba8495 /lisp/xdg.el
parentce9640845155c1dd9c11e46104f223af7cd4f7fa (diff)
downloademacs-be9bc8e67d6caf6d61fe4f46ac5b640ada16ba95.tar.gz
; Fix previous commit
See https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00101.html * test/lisp/xdg.el: Remove match data tests. * lisp/xdg.el (xdg-user-dir): Fix docstring. Remove save-match-data. (xdg-desktop-read-file, xdg-desktop-strings): Remove save-match-data.
Diffstat (limited to 'lisp/xdg.el')
-rw-r--r--lisp/xdg.el39
1 files changed, 18 insertions, 21 deletions
diff --git a/lisp/xdg.el b/lisp/xdg.el
index 4b255429db4..c7000219487 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -143,12 +143,11 @@ This should be called at the beginning of a line."
res))
(defun xdg-user-dir (name)
- "Return the path of user directory referred to by NAME."
+ "Return the directory referred to by NAME."
(when (null xdg-user-dirs)
- (save-match-data
- (setq xdg-user-dirs
- (xdg--user-dirs-parse-file
- (expand-file-name "user-dirs.dirs" (xdg-config-home))))))
+ (setq xdg-user-dirs
+ (xdg--user-dirs-parse-file
+ (expand-file-name "user-dirs.dirs" (xdg-config-home)))))
(let ((dir (cdr (assoc name xdg-user-dirs))))
(when dir (expand-file-name dir))))
@@ -182,27 +181,25 @@ This should be called at the beginning of a line."
(let ((res (make-hash-table :test #'equal))
elt group)
(with-temp-buffer
- (save-match-data
- (insert-file-contents-literally filename)
- (goto-char (point-min))
- (while (or (= (following-char) ?#)
- (string-blank-p (buffer-substring (point) (point-at-eol))))
- (forward-line))
- (unless (equal (setq group (xdg--desktop-parse-line)) "Desktop Entry")
- (error "Wrong first section: %s" group))
- (while (not (eobp))
- (when (consp (setq elt (xdg--desktop-parse-line)))
- (puthash (car elt) (cdr elt) res))
- (forward-line))))
+ (insert-file-contents-literally filename)
+ (goto-char (point-min))
+ (while (or (= (following-char) ?#)
+ (string-blank-p (buffer-substring (point) (point-at-eol))))
+ (forward-line))
+ (unless (equal (setq group (xdg--desktop-parse-line)) "Desktop Entry")
+ (error "Wrong first section: %s" group))
+ (while (not (eobp))
+ (when (consp (setq elt (xdg--desktop-parse-line)))
+ (puthash (car elt) (cdr elt) res))
+ (forward-line)))
res))
(defun xdg-desktop-strings (value)
"Partition VALUE into elements delimited by unescaped semicolons."
(let (res)
- (save-match-data
- (setq value (string-trim-left value))
- (dolist (x (split-string (replace-regexp-in-string "\\\\;" "\0" value) ";"))
- (push (replace-regexp-in-string "\0" ";" x) res)))
+ (setq value (string-trim-left value))
+ (dolist (x (split-string (replace-regexp-in-string "\\\\;" "\0" value) ";"))
+ (push (replace-regexp-in-string "\0" ";" x) res))
(when (null (string-match-p "[^[:blank:]]" (car res))) (pop res))
(nreverse res)))