aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Bernoulli2012-12-19 14:51:40 -0500
committerStefan Monnier2012-12-19 14:51:40 -0500
commitee3c0aeca4e1e31e2b171a4753782a37076e7457 (patch)
tree969ab619c9555b98971146b54d48f25ca94f33ec
parentf4d79bd021831eb64e1bfc7f5c5b1ddb2138b37a (diff)
downloademacs-ee3c0aeca4e1e31e2b171a4753782a37076e7457.tar.gz
emacs-ee3c0aeca4e1e31e2b171a4753782a37076e7457.zip
* 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. Fixes: debbugs:13207
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/tips.texi7
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/emacs-lisp/lisp-mnt.el48
4 files changed, 48 insertions, 21 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index a0bbafb116f..d8a825374ed 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12012-12-19 Jonas Bernoulli <jonas@bernoul.li>
2
3 * tips.texi (Library Headers): New header keyword `Homepage'.
4 Make continuation lines syntax more precise.
5
12012-12-17 Eli Zaretskii <eliz@gnu.org> 62012-12-17 Eli Zaretskii <eliz@gnu.org>
2 7
3 * files.texi (File Attributes, Changing Files): Update to include 8 * files.texi (File Attributes, Changing Files): Update to include
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index d54d91b238a..854ce8f124f 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -942,6 +942,7 @@ explains these conventions, starting with an example:
942;; Created: 14 Jul 2010 942;; Created: 14 Jul 2010
943@group 943@group
944;; Keywords: languages 944;; Keywords: languages
945;; Homepage: http://example.com/foo
945 946
946;; This file is not part of GNU Emacs. 947;; This file is not part of GNU Emacs.
947 948
@@ -980,8 +981,7 @@ the conventional possibilities for @var{header-name}:
980@item Author 981@item Author
981This line states the name and email address of at least the principal 982This line states the name and email address of at least the principal
982author of the library. If there are multiple authors, list them on 983author of the library. If there are multiple authors, list them on
983continuation lines led by @code{;;} and whitespace (this is easier 984continuation lines led by @code{;;} and a tab or at least two spaces.
984for tools to parse than having more than one author on one line).
985We recommend including a contact email address, of the form 985We recommend including a contact email address, of the form
986@samp{<@dots{}>}. For example: 986@samp{<@dots{}>}. For example:
987 987
@@ -1028,6 +1028,9 @@ The name of this field is unfortunate, since people often assume it is
1028the place to write arbitrary keywords that describe their package, 1028the place to write arbitrary keywords that describe their package,
1029rather than just the relevant Finder keywords. 1029rather than just the relevant Finder keywords.
1030 1030
1031@item Homepage
1032This line states the homepage of the library.
1033
1031@item Package-Version 1034@item Package-Version
1032If @samp{Version} is not suitable for use by the package manager, then 1035If @samp{Version} is not suitable for use by the package manager, then
1033a package can define @samp{Package-Version}; it will be used instead. 1036a package can define @samp{Package-Version}; it will be used instead.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3fd8b363546..f61eb7b2bfd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,11 @@
12012-12-19 Stefan Monnier <monnier@iro.umontreal.ca> 12012-12-19 Jonas Bernoulli <jonas@bernoul.li>
2
3 * emacs-lisp/lisp-mnt.el (lm-section-end): Always end before the
4 following non-comment text (bug#13207).
5 (lm-header-multiline): Continuation lines need to be indented more than
6 the first line.
7 (lm-homepage): New function.
8 (lm-with-file): Don't be confused if narrowing is in effect.
2 9
3 * vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the 10 * vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the
4 very beginning of a hunk (e.g. killing the first line). 11 very beginning of a hunk (e.g. killing the first line).
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index f9a1c5dbf83..807b4d2eb86 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -208,10 +208,10 @@ If the given section does not exist, return nil."
208The HEADER is the section string marking the beginning of the 208The HEADER is the section string marking the beginning of the
209section. If the given section does not exist, return nil. 209section. If the given section does not exist, return nil.
210 210
211The end of the section is defined as the beginning of the next 211The section ends before the first non-comment text or the next
212section of the same level or lower. The function 212section of the same level or lower; whatever comes first. The
213`lisp-outline-level' is used to compute the level of a section. 213function `lisp-outline-level' is used to compute the level of
214If no such section exists, return the end of the buffer." 214a section."
215 (require 'outline) ;; for outline-regexp. 215 (require 'outline) ;; for outline-regexp.
216 (let ((start (lm-section-start header))) 216 (let ((start (lm-section-start header)))
217 (when start 217 (when start
@@ -229,9 +229,15 @@ If no such section exists, return the end of the buffer."
229 (beginning-of-line) 229 (beginning-of-line)
230 (lisp-outline-level)) 230 (lisp-outline-level))
231 level))) 231 level)))
232 (if next-section-found 232 (min (if next-section-found
233 (line-beginning-position) 233 (progn (beginning-of-line 0)
234 (point-max))))))) 234 (unless (looking-at " ")
235 (beginning-of-line 2))
236 (point))
237 (point-max))
238 (progn (goto-char start)
239 (while (forward-comment 1))
240 (point))))))))
235 241
236(defsubst lm-code-start () 242(defsubst lm-code-start ()
237 "Return the buffer location of the `Code' start marker." 243 "Return the buffer location of the `Code' start marker."
@@ -282,13 +288,8 @@ The returned value is a list of strings, one per line."
282 (when res 288 (when res
283 (setq res (list res)) 289 (setq res (list res))
284 (forward-line 1) 290 (forward-line 1)
285 (while (and (or (looking-at (concat lm-header-prefix "[\t ]+")) 291 (while (looking-at "^;+\\(\t\\|[\t\s]\\{2,\\}\\)\\(.+\\)")
286 (and (not (looking-at 292 (push (match-string-no-properties 2) res)
287 (lm-get-header-re "\\sw\\(\\sw\\|\\s_\\)*")))
288 (looking-at lm-header-prefix)))
289 (goto-char (match-end 0))
290 (looking-at ".+"))
291 (setq res (cons (match-string-no-properties 0) res))
292 (forward-line 1))) 293 (forward-line 1)))
293 (nreverse res)))) 294 (nreverse res))))
294 295
@@ -306,10 +307,13 @@ If FILE is nil, execute BODY in the current buffer."
306 (emacs-lisp-mode) 307 (emacs-lisp-mode)
307 ,@body) 308 ,@body)
308 (save-excursion 309 (save-excursion
309 ;; Switching major modes is too drastic, so just switch 310 (save-restriction
310 ;; temporarily to the Emacs Lisp mode syntax table. 311 (widen)
311 (with-syntax-table emacs-lisp-mode-syntax-table 312 (goto-char (point-min))
312 ,@body)))))) 313 ;; Switching major modes is too drastic, so just switch
314 ;; temporarily to the Emacs Lisp mode syntax table.
315 (with-syntax-table emacs-lisp-mode-syntax-table
316 ,@body)))))))
313 317
314;; Fixme: Probably this should be amalgamated with copyright.el; also 318;; Fixme: Probably this should be amalgamated with copyright.el; also
315;; we need a check for ranges in copyright years. 319;; we need a check for ranges in copyright years.
@@ -489,6 +493,14 @@ absent, return nil."
489 (when start 493 (when start
490 (buffer-substring-no-properties start (lm-commentary-end)))))) 494 (buffer-substring-no-properties start (lm-commentary-end))))))
491 495
496(defun lm-homepage (&optional file)
497 "Return the homepage in file FILE, or current buffer if FILE is nil."
498 (let ((page (lm-with-file file
499 (lm-header "\\(?:x-\\)?\\(?:homepage\\|url\\)"))))
500 (if (and page (string-match "^<.+>$" page))
501 (substring page 1 -1)
502 page)))
503
492;;; Verification and synopses 504;;; Verification and synopses
493 505
494(defun lm-insert-at-column (col &rest strings) 506(defun lm-insert-at-column (col &rest strings)