all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Wrapper for query-replace does not use query-replace-history
@ 2009-06-11  7:48 Nordlöw
  2009-06-12  0:45 ` Barry Margolin
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2009-06-11  7:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hey I have a built a convenience wrapper for query-replace-regexp that
surrounds it argument with beginning and end of symbol regexps. I want
it to modify query-replace-history but it doesn't. Why?

/Nordlöw

Code follows.

(defun build-symbol-regexp (id)
  "Matches an ID as single word symbol (or C identifier) that
does not respect underscore."
  (concat "\\_<" id "\\_>"))

;; In Emacs-Lisp mode minus-sign is not allowed before or after.
(defun query-replace-symbol (source dest)
  "Rename a symbol (currently C-style) string symbol (identifier)
which unique name
 is determined by SOURCE replacing it with DEST."
  (interactive "sQuery replace symbol (identifier): \nsReplace with:
")
  (query-replace-regexp (build-symbol-regexp
                         (regexp-quote source)) ;quote string to
regexp
                        (concat dest)))


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-12  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11  7:48 Wrapper for query-replace does not use query-replace-history Nordlöw
2009-06-12  0:45 ` Barry Margolin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.