Function: dired--display-filename-with-newline-warning
dired--display-filename-with-newline-warning is a byte-compiled
function defined in dired.el.gz.
Signature
(dired--display-filename-with-newline-warning DIR)
Documentation
Display a warning if buffer DIR has a file name with a newline.
Source Code
;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired--display-filename-with-newline-warning (dir)
"Display a warning if buffer DIR has a file name with a newline."
(let ((msg "Literal newline in file name.
This Dired buffer displays a file name containing a literal newline character.
Executing Dired operations on files displayed this way may fail and signal an
error. To avoid this you can temporarily change the display for all Dired
buffers, so that newlines in file names appear as \"\\n\", by typing `M-:' and
entering `(setopt dired-auto-toggle-b-switch t)' in the minibuffer. To change
the display only for this Dired buffer click or press RETURN `%s'.
See `%s' for other alternatives and more information."))
(display-warning
'dired
(format-message
msg
(buttonize "here"
(lambda (_)
(pop-to-buffer dir)
(when (dired--filename-with-newline-p)
(unless (dired-switches-escape-p dired-actual-switches)
(setq dired-actual-switches
(concat dired-actual-switches " -b"))
(dired-revert))))
nil "mouse-2: Change newline display")
(buttonize "(emacs) Dired Enter"
(lambda (_)
(info "(emacs) Dired Enter")
(declare-function Info-goto-node "info")
(with-current-buffer "*info*"
(Info-goto-node "File names with newline")))
nil "mouse-2: Jump to Info node")))
;; Display *Warnings* buffer with point at start of message instead
;; of at the end.
(with-current-buffer "*Warnings*"
(set-window-point (get-buffer-window)
(search-backward "Warning (dired)")))))