I am searching in a buffer for a regular expression by this snippet:
(setq jb-revision-version "\\([[:digit:]]+\\.?\\)")
(setq jb-revision-string "\\(\\(Revision\\|Id\\): +\\)")
(progn
(save-excursion
(goto-char (point-min))
(setq start (re-search-forward jb-revision-string)
end (re-search-forward (concat jb-revision-version "+")))
(setq version (buffer-substring start end))))
The result in variable version is this:
version
#("0.1.2" 0 5 (face font-lock-comment-face fontified nil))
What I want, is the pure string "0.1.2"
in this case.
Even if I insert (font-lock-mode -1) ... (font-lock-mode 1)
in my above code, the result still contains some font-lock-info:
#("0.1.2" 0 5 (fontified nil))
I haven't found any font-lock-to-string
function, to get rid of that stuff. Neither did I find a command, to temporarily defontify the buffer before searching.
I haven't found any hints in the Emacs, Emacs-Lisp or the Lisp-Introduction Info manuals.
buffer-substring-no-properties
? the description for thebuffer-substring
function says it returns text properties as well as the characters.