all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 28998@debbugs.gnu.org
Subject: bug#28998: 27.0.50; Man--sections is in reverse order
Date: Tue, 07 Nov 2017 15:07:09 +0000	[thread overview]
Message-ID: <87inemm8ki.fsf@gmail.com> (raw)
In-Reply-To: <87tvy66hf5.fsf@users.sourceforge.net> (Noam Postavsky's message of "Mon, 06 Nov 2017 19:50:22 -0500")

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Keep-Man-sections-in-natural-order-bug-28998.patch --]
[-- Type: text/x-diff, Size: 868 bytes --]

From 6bc6f316f4bd3dc80b96d2d894bce66487cb9127 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Wed, 25 Oct 2017 16:57:43 +0100
Subject: [PATCH 1/2] Keep Man sections in natural order (bug#28998)

* lisp/man.el (Man-build-section-alist): Reverse sections.
---
 lisp/man.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/man.el b/lisp/man.el
index 7a892c6e88..f7b1609c92 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1522,7 +1522,8 @@ Man-build-section-alist
       (let ((section (match-string 1)))
         (unless (member section Man--sections)
           (push section Man--sections)))
-      (forward-line 1))))
+      (forward-line 1)))
+  (setq Man--sections (nreverse Man--sections)))
 
 (defsubst Man-build-references-alist ()
   "Build the list of references (in the SEE ALSO section)."
-- 
2.14.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Rename-Man-build-section-alist-bug-28998.patch --]
[-- Type: text/x-diff, Size: 2138 bytes --]

From f96f95b830825681fb618f1727fcc3e0f488102f Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Tue, 7 Nov 2017 14:51:37 +0000
Subject: [PATCH 2/2] Rename Man-build-section-alist (bug#28998)

The defsubst Man-build-section-alist builds and returns a list of
strings, so rename it to Man-build-section-list and make it a defun.

* lisp/man.el (Man-build-section-alist): Do it and reduce syntax.
(Man-goto-page):
* lisp/woman.el (woman-find-file): Use it.
---
 lisp/man.el   | 10 +++++-----
 lisp/woman.el |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/man.el b/lisp/man.el
index f7b1609c92..798e78bbe7 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1513,16 +1513,16 @@ Man-mode
   (set (make-local-variable 'bookmark-make-record-function)
        'Man-bookmark-make-record))
 
-(defsubst Man-build-section-alist ()
+(defun Man-build-section-list ()
   "Build the list of manpage sections."
-  (setq Man--sections nil)
+  (setq Man--sections ())
   (goto-char (point-min))
   (let ((case-fold-search nil))
-    (while (re-search-forward Man-heading-regexp (point-max) t)
+    (while (re-search-forward Man-heading-regexp nil t)
       (let ((section (match-string 1)))
         (unless (member section Man--sections)
           (push section Man--sections)))
-      (forward-line 1)))
+      (forward-line)))
   (setq Man--sections (nreverse Man--sections)))
 
 (defsubst Man-build-references-alist ()
@@ -1803,7 +1803,7 @@ Man-goto-page
       (widen)
       (goto-char page-start)
       (narrow-to-region page-start page-end)
-      (Man-build-section-alist)
+      (Man-build-section-list)
       (Man-build-references-alist)
       (goto-char (point-min)))))
 
diff --git a/lisp/woman.el b/lisp/woman.el
index 111086e362..1edf6e34c3 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1619,7 +1619,7 @@ woman-find-file
 	      (setq woman-buffer-alist
 		    (cons (cons file-name bufname) woman-buffer-alist)
 		    woman-buffer-number 0)))))
-  (Man-build-section-alist)
+  (Man-build-section-list)
   (Man-build-references-alist)
   (goto-char (point-min)))
 
-- 
2.14.2


[-- Attachment #3: Type: text/plain, Size: 410 bytes --]


Noam Postavsky <npostavs@users.sourceforge.net> writes:

>> -(defsubst Man-build-section-alist ()
>> +(defsubst Man-build-section-list ()
>
> Perhaps we should switch to defun while we're at it?
>
>> -  (let ((case-fold-search nil))
>> +  (let (case-fold-search)
>
> Personally, I like the more explicit version here.

I attach slightly reworded patches updated with your two
suggestions.

Thanks,

-- 
Basil

  reply	other threads:[~2017-11-07 15:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 16:35 bug#28998: 27.0.50; Man--sections is in reverse order Basil L. Contovounesios
2017-11-07  0:50 ` Noam Postavsky
2017-11-07 15:07   ` Basil L. Contovounesios [this message]
2017-11-07 17:43     ` Noam Postavsky
2017-11-11 16:18       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inemm8ki.fsf@gmail.com \
    --to=contovob@tcd.ie \
    --cc=28998@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.