help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quote marked region [utilities]


From: Jean Louis
Subject: Quote marked region [utilities]
Date: Sun, 28 Mar 2021 12:59:17 +0300

Few utilities I have made today for quoting marked region with quotes
or escaped quotes. Very simple and handy when editing quoted strings,
like function descriptions or similar. Who knows, maybe it already
exists in Emacs.

(defun quote-region-single (start end)
  "Quotes marked region with single quotes."
  (interactive "r")
  (goto-char end)
  (insert "'")
  (goto-char start)
  (insert "'"))

(defun quote-region-double (start end)
  "Quotes marked region with double quotes."
  (interactive "r")
  (goto-char end)
  (insert "\"")
  (goto-char start)
  (insert "\""))

(defun quote-region-double-escaped (start end)
  "Quotes marked region with escaped double quotes."
  (interactive "r")
  (goto-char end)
  (insert "\\\"")
  (goto-char start)
  (insert "\\\""))


Jean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]