aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli2012-12-19 14:51:40 -0500
committerStefan Monnier2012-12-19 14:51:40 -0500
commitee3c0aeca4e1e31e2b171a4753782a37076e7457 (patch)
tree969ab619c9555b98971146b54d48f25ca94f33ec /lisp
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
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/emacs-lisp/lisp-mnt.el48
2 files changed, 38 insertions, 19 deletions
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)