[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111270: * lisp/emacs-lisp/lisp-mnt.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111270: * lisp/emacs-lisp/lisp-mnt.el (lm-section-end): Always end before the |
Date: |
Wed, 19 Dec 2012 14:51:40 -0500 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111270
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13207
author: Jonas Bernoulli <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2012-12-19 14:51:40 -0500
message:
* lisp/emacs-lisp/lisp-mnt.el (lm-section-end): Always end before the
following non-comment text.
(lm-header-multiline): Continuation lines need to be indented more than
the first line.
(lm-homepage): New function.
(lm-with-file): Don't be confused if narrowing is in effect.
* doc/lispref/tips.texi (Library Headers): New header keyword `Homepage'.
Make continuation lines syntax more precise.
modified:
doc/lispref/ChangeLog
doc/lispref/tips.texi
lisp/ChangeLog
lisp/emacs-lisp/lisp-mnt.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2012-12-17 19:14:34 +0000
+++ b/doc/lispref/ChangeLog 2012-12-19 19:51:40 +0000
@@ -1,3 +1,8 @@
+2012-12-19 Jonas Bernoulli <address@hidden>
+
+ * tips.texi (Library Headers): New header keyword `Homepage'.
+ Make continuation lines syntax more precise.
+
2012-12-17 Eli Zaretskii <address@hidden>
* files.texi (File Attributes, Changing Files): Update to include
=== modified file 'doc/lispref/tips.texi'
--- a/doc/lispref/tips.texi 2012-12-05 22:27:56 +0000
+++ b/doc/lispref/tips.texi 2012-12-19 19:51:40 +0000
@@ -942,6 +942,7 @@
;; Created: 14 Jul 2010
@group
;; Keywords: languages
+;; Homepage: http://example.com/foo
;; This file is not part of GNU Emacs.
@@ -980,8 +981,7 @@
@item Author
This line states the name and email address of at least the principal
author of the library. If there are multiple authors, list them on
-continuation lines led by @code{;;} and whitespace (this is easier
-for tools to parse than having more than one author on one line).
+continuation lines led by @code{;;} and a tab or at least two spaces.
We recommend including a contact email address, of the form
@samp{<@dots{}>}. For example:
@@ -1028,6 +1028,9 @@
the place to write arbitrary keywords that describe their package,
rather than just the relevant Finder keywords.
address@hidden Homepage
+This line states the homepage of the library.
+
@item Package-Version
If @samp{Version} is not suitable for use by the package manager, then
a package can define @samp{Package-Version}; it will be used instead.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-12-19 19:41:43 +0000
+++ b/lisp/ChangeLog 2012-12-19 19:51:40 +0000
@@ -1,4 +1,11 @@
-2012-12-19 Stefan Monnier <address@hidden>
+2012-12-19 Jonas Bernoulli <address@hidden>
+
+ * emacs-lisp/lisp-mnt.el (lm-section-end): Always end before the
+ following non-comment text (bug#13207).
+ (lm-header-multiline): Continuation lines need to be indented more than
+ the first line.
+ (lm-homepage): New function.
+ (lm-with-file): Don't be confused if narrowing is in effect.
* vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the
very beginning of a hunk (e.g. killing the first line).
=== modified file 'lisp/emacs-lisp/lisp-mnt.el'
--- a/lisp/emacs-lisp/lisp-mnt.el 2012-01-19 07:21:25 +0000
+++ b/lisp/emacs-lisp/lisp-mnt.el 2012-12-19 19:51:40 +0000
@@ -208,10 +208,10 @@
The HEADER is the section string marking the beginning of the
section. If the given section does not exist, return nil.
-The end of the section is defined as the beginning of the next
-section of the same level or lower. The function
-`lisp-outline-level' is used to compute the level of a section.
-If no such section exists, return the end of the buffer."
+The section ends before the first non-comment text or the next
+section of the same level or lower; whatever comes first. The
+function `lisp-outline-level' is used to compute the level of
+a section."
(require 'outline) ;; for outline-regexp.
(let ((start (lm-section-start header)))
(when start
@@ -229,9 +229,15 @@
(beginning-of-line)
(lisp-outline-level))
level)))
- (if next-section-found
- (line-beginning-position)
- (point-max)))))))
+ (min (if next-section-found
+ (progn (beginning-of-line 0)
+ (unless (looking-at "")
+ (beginning-of-line 2))
+ (point))
+ (point-max))
+ (progn (goto-char start)
+ (while (forward-comment 1))
+ (point))))))))
(defsubst lm-code-start ()
"Return the buffer location of the `Code' start marker."
@@ -282,13 +288,8 @@
(when res
(setq res (list res))
(forward-line 1)
- (while (and (or (looking-at (concat lm-header-prefix "[\t ]+"))
- (and (not (looking-at
- (lm-get-header-re "\\sw\\(\\sw\\|\\s_\\)*")))
- (looking-at lm-header-prefix)))
- (goto-char (match-end 0))
- (looking-at ".+"))
- (setq res (cons (match-string-no-properties 0) res))
+ (while (looking-at "^;+\\(\t\\|[\t\s]\\{2,\\}\\)\\(.+\\)")
+ (push (match-string-no-properties 2) res)
(forward-line 1)))
(nreverse res))))
@@ -306,10 +307,13 @@
(emacs-lisp-mode)
,@body)
(save-excursion
- ;; Switching major modes is too drastic, so just switch
- ;; temporarily to the Emacs Lisp mode syntax table.
- (with-syntax-table emacs-lisp-mode-syntax-table
- ,@body))))))
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ ;; Switching major modes is too drastic, so just switch
+ ;; temporarily to the Emacs Lisp mode syntax table.
+ (with-syntax-table emacs-lisp-mode-syntax-table
+ ,@body)))))))
;; Fixme: Probably this should be amalgamated with copyright.el; also
;; we need a check for ranges in copyright years.
@@ -489,6 +493,14 @@
(when start
(buffer-substring-no-properties start (lm-commentary-end))))))
+(defun lm-homepage (&optional file)
+ "Return the homepage in file FILE, or current buffer if FILE is nil."
+ (let ((page (lm-with-file file
+ (lm-header "\\(?:x-\\)?\\(?:homepage\\|url\\)"))))
+ (if (and page (string-match "^<.+>$" page))
+ (substring page 1 -1)
+ page)))
+
;;; Verification and synopses
(defun lm-insert-at-column (col &rest strings)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111270: * lisp/emacs-lisp/lisp-mnt.el (lm-section-end): Always end before the,
Stefan Monnier <=