Subject: bug#22510: closed (Re: bug#22616: 25.0.50; Change to lm-header breaks lm-header-multiline)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 11 May 2016 22:35:02 +0000

Your bug report

#22616: 25.1.50; error in lm-header-multiline

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22616: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22616
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#22616: 25.0.50; Change to lm-header breaks lm-header-multiline
From: Dmitry Gutov <[email-masked]>
To: Artur Malabarba <[email-masked]>, Jonas Bernoulli <[email-masked]>, [email-masked]
Date: Thu, 12 May 2016 01:34:44 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 25.1

On 05/11/2016 03:00 AM, Dmitry Gutov wrote:

> Moving save-excursion there does help.

Applied, and closing.

Thanks all.

Subject: 25.1.50; error in lm-header-multiline
From: John Kitchin <[email-masked]>
To: [email-masked]
Date: Sun, 31 Jan 2016 17:56:12 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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