mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Print "decrypted" rot13 text is buffer is read-only
* lisp/rot13.el (rot13-region): Add fallback if buffer is read-only * doc/emacs/rmail.texi (Rmail Rot13): Document new behaviour.
This commit is contained in:
parent
f3c138bb1a
commit
b2401cdfd2
2 changed files with 17 additions and 2 deletions
|
|
@ -85,9 +85,16 @@ and END, and return the encrypted string."
|
|||
|
||||
;;;###autoload
|
||||
(defun rot13-region (start end)
|
||||
"ROT13 encrypt the region between START and END in current buffer."
|
||||
"ROT13 encrypt the region between START and END in current buffer.
|
||||
If invoked interactively and the buffer is read-only, a message
|
||||
will be printed instead."
|
||||
(interactive "r")
|
||||
(translate-region start end rot13-translate-table))
|
||||
(condition-case nil
|
||||
(translate-region start end rot13-translate-table)
|
||||
(buffer-read-only
|
||||
(when (called-interactively-p 'interactive)
|
||||
(let ((dec (rot13-string (buffer-substring start end))))
|
||||
(message "Buffer is read-only:\n%s" (string-trim dec)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun rot13-other-window ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue