aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab2016-03-08 21:32:52 +0100
committerAndreas Schwab2016-03-08 21:45:25 +0100
commit02bf7cc4632dae6bd679f34307fc83ccc8510471 (patch)
treeaffc5dc78c36d3d433a5ad72bb847f7f9ca0228c
parent16cf469d3424e927ead856fd410b8a5eee1ec8a6 (diff)
downloademacs-02bf7cc4632dae6bd679f34307fc83ccc8510471.tar.gz
emacs-02bf7cc4632dae6bd679f34307fc83ccc8510471.zip
Properly handle unquoting in wdired (bug 22938)
The recorded old names are not quoted, don't unquote them. * lisp/wdired.el (wdired-normalize-filename): Add argument unquotep, only unquote if non-nil. (wdired-get-filename): Don't unquote the old file name. (wdired-get-previous-link): Always unquote.
-rw-r--r--lisp/wdired.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 795e50d16d5..16ea67dba56 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -294,14 +294,15 @@ or \\[wdired-abort-changes] to abort changes")))
294 (put-text-property b-protection (point-max) 'read-only t)))) 294 (put-text-property b-protection (point-max) 'read-only t))))
295 295
296;; This code is a copy of some dired-get-filename lines. 296;; This code is a copy of some dired-get-filename lines.
297(defsubst wdired-normalize-filename (file) 297(defsubst wdired-normalize-filename (file unquotep)
298 (setq file 298 (when unquotep
299 ;; FIXME: shouldn't we check for a `b' argument or somesuch before 299 (setq file
300 ;; doing such unquoting? --Stef 300 ;; FIXME: shouldn't we check for a `b' argument or somesuch before
301 (read (concat 301 ;; doing such unquoting? --Stef
302 "\"" (replace-regexp-in-string 302 (read (concat
303 "\\([^\\]\\|\\`\\)\"" "\\1\\\\\"" file) 303 "\"" (replace-regexp-in-string
304 "\""))) 304 "\\([^\\]\\|\\`\\)\"" "\\1\\\\\"" file)
305 "\""))))
305 (and file buffer-file-coding-system 306 (and file buffer-file-coding-system
306 (not file-name-coding-system) 307 (not file-name-coding-system)
307 (not default-file-name-coding-system) 308 (not default-file-name-coding-system)
@@ -329,7 +330,8 @@ non-nil means return old filename."
329 ;; deletion. 330 ;; deletion.
330 (setq end (next-single-property-change beg 'end-name)) 331 (setq end (next-single-property-change beg 'end-name))
331 (setq file (buffer-substring-no-properties (1+ beg) end))) 332 (setq file (buffer-substring-no-properties (1+ beg) end)))
332 (and file (setq file (wdired-normalize-filename file)))) 333 ;; Don't unquote the old name, it wasn't quoted in the first place
334 (and file (setq file (wdired-normalize-filename file (not old)))))
333 (if (or no-dir old) 335 (if (or no-dir old)
334 file 336 file
335 (and file (> (length file) 0) 337 (and file (> (length file) 0)
@@ -627,7 +629,7 @@ If OLD, return the old target. If MOVE, move point before it."
627 (setq end (next-single-property-change beg 'end-link)) 629 (setq end (next-single-property-change beg 'end-link))
628 (setq target (buffer-substring-no-properties (1+ beg) end))) 630 (setq target (buffer-substring-no-properties (1+ beg) end)))
629 (if move (goto-char (1- beg))))) 631 (if move (goto-char (1- beg)))))
630 (and target (wdired-normalize-filename target)))) 632 (and target (wdired-normalize-filename target t))))
631 633
632(declare-function make-symbolic-link "fileio.c") 634(declare-function make-symbolic-link "fileio.c")
633 635