unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22510: 25.1.50; error in lm-header-multiline
@ 2016-01-31 22:56 John Kitchin
  0 siblings, 0 replies; only message in thread
From: John Kitchin @ 2016-01-31 22:56 UTC (permalink / raw)
  To: 22510

I think there is a bug in lm-header-multiline in lisp-mnt.el.

It does not actually read multiline headers because in line 285, the
call to lm-header does not move point, and the subsequent code does not
read the next lines.

I do not see a good fix. One could modify the lm-header code or add the
code to lm-header-multiline. I am not sure of the implications of either
of these.

Here is my solution that returns single and multiline headers. I have
signed FSF papers, so you are welcome to this code if you like it.

thanks,

(defun lm-header (header)
  "Return the contents of the header named HEADER.
If the HEADER is multiline, a list of strings is returned."
  (save-excursion
    (goto-char (point-min))
    (let ((case-fold-search t)
          res)
      (when (and (re-search-forward
                  (lm-get-header-re header)
                  (lm-code-mark) t)
                 ;;   RCS ident likes format "$identifier: data$"
                 (looking-at
                  (if (save-excursion
                        (skip-chars-backward "^$" (match-beginning 0))
                        (= (point) (match-beginning 0)))
                      "[^\n]+" "[^$\n]+")))
        (setq res (list (match-string-no-properties 0)))
        (forward-line 1)
        (while (looking-at "^;+\\(\t\\|[\t\s]\\{2,\\}\\)\\(.+\\)")
          (push (match-string-no-properties 2) res)
          (forward-line 1))
        (setq res (nreverse res))
        (if (= 1 (length res))
            (car res)
          res)))))



--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-31 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-31 22:56 bug#22510: 25.1.50; error in lm-header-multiline John Kitchin

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).