annotate lisp/elide-head.el @ 100267:c851df8e004e

2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-id.el (org-id-locations-file): Wrap file name with `convert-standard-filename'. (org-id-files): New variable. (org-id-use-hash): New option. (org-id-update-id-locations): Also search in all files current listed in `org-id-files'. Convert the resulting alist to a hash if the user customation says so. (org-id-locations-save): Handle he case if `org-id-locations' is a hash. (org-id-locations-load): Convert the alist to a hash. (org-id-add-location): Handle the hast case. (kill-emacs-hook): Make sure id locations are saved when Emacs is exited. (org-id-hash-to-alist, org-id-alist-to-hash) (org-id-paste-tracker): New functions. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-goto-calendar): Remove duplicate let bindings of calendar variables. * org-table.el (org-table-find-row-type): Renamed from `org-find-row-type'. (org-table-rewrite-old-row-references): Renamed from `org-rewrite-old-row-references'. (org-table-shift-refpart): Renamed from `org-shift-refpart'. (org-table-cleanup-narrow-column-properties): Renamed from `org-cleanup-narrow-column-properties'. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-find-row-type): New arguments DESC and CLINE, for better error messages. (org-table-get-descriptor-line): Supply the new arguments to `org-find-row-type'. (org-table-error-on-row-ref-crossing-hline): New option. * org.el (org-target-link-regexp): Make buffer-local. (org-move-subtree-down): Fix bug with trees at beginning of buffer. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-faces.el (org-set-tag-faces): New function. (org-tags-special-faces-re): New variable. * org.el (org-font-lock-add-tag-faces, org-get-tag-face): New functions. * org-faces.el (org-tag-faces): New option. (org-tag): Mention `org-tag-faces' in the docstring. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-html-style-default): Implement new quoting. * org-jsinfo.el (org-infojs-template): Implement new quoting. * org-w3m.el (w3m-minor-mode-hook): Also add the special copy command to the `w3m-minor-mode-map'. * org-archive.el (org-archive-to-archive-sibling): Protect `this-command' to avoid appending kills during archiving. * org-exp.el (org-export-with-priority): New variable. (org-export-add-options-to-plist): Use `org-export-plist-vars' instead of internal list of strings and properties. (org-print-icalendar-entries): Retrieve the location property with inheritance. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-with-todo-keywords): New option. (org-export-plist-vars): Include also the keys for the #+OPTIONS line. (org-default-export-plist, org-export-add-options-to-plist) (org-export-as-ascii, org-export-as-html): Use the new structure of `org-export-plist-vars'. * org.el (org-map-entries): Return all values. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-matcher-time): Recognize more special values. * org-gnus.el (fboundp): Fix defvaralias for XEmacs. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-tags-exclude-from-inheritance): New option. (org-tag-inherit-p, org-remove-uniherited-tags): Respect `org-tags-exclude-from-inheritance'. * org-agenda.el (org-agenda-show-inherited-tags): New option. (org-format-agenda-item): Add inherited tags to the agenda line string, and make sure that properties are kept when downcasing the tags list. (org-agenda-add-inherited-tags): New function. (org-downcase-keep-props): New function. * org.el (org-scan-tags): Mark inherited tags with a text property. (org-get-tags-at): Mark inherited tags with a text property. (org-add-prop-inherited): New function. * org-agenda.el (org-agenda-add-inherited-tags): New function. (org-agenda-show-inherited-tags): New option. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-modules): Add org-w3m to the default modules. * org-table.el (orgtbl-self-insert-command): Make S-SPC work in orgtbl-mode. (orgtabl-create-or-convert-from-region): New command. * org-exp.el (org-export-as-ascii): Remove the handling of targets. (org-export-ascii-preprocess): Handle targets already in this function. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer-start-time): Define this variable. (org-timer-item): Make argument optional. * org-list.el (org-insert-item): Automatically insert a timer item if the current list is a timer list. * org-timer.el: New file. * org-publish.el (org-publish-org-index): Only exclude the index file in the main directory from being added to the site-map. (org-publish-get-project-from-filename): If the current project is a component, start publishing from the parent project. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (orgtbl-ret): Fix RET at beginning-of-buffer. * org-publish.el (org-publish-org-index): Improve removal of temporary buffers.
author Carsten Dominik <dominik@science.uva.nl>
date Sun, 07 Dec 2008 18:36:02 +0000
parents e7c3af7f57eb
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35701
diff changeset
1 ;;; elide-head.el --- hide headers in files
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
2
95070
e7c3af7f57eb (elide-head-headers-to-hide): Handle GPLv3 format.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
3 ;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
e7c3af7f57eb (elide-head-headers-to-hide): Handle GPLv3 format.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
4 ;; 2008 Free Software Foundation, Inc.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
5
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
6 ;; Author: Dave Love <fx@gnu.org>
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
7 ;; Keywords: outlines tools
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
8
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
10
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
15
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
20
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
23
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
25
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
26 ;; Functionality for eliding boilerplate text (normally copyright
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
27 ;; notices) in file headers to avoid clutter when you know what it
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
28 ;; says.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
29 ;;
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
30 ;; `elide-head-headers-to-hide' controls what is elided by the command
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
31 ;; `elide-head'. A buffer-local invisible overlay manages the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
32 ;; elision.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
33
26700
61f2605f9e41 Comments only.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
34 ;; You might add `elide-head' to appropriate major mode hooks or to
46899
f00337f04e78 Use find-file-hook instead of find-file-hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38436
diff changeset
35 ;; `find-file-hook'. Please do not do this in site init files. If
26703
b8145f3d528e Fix commentary.
Dave Love <fx@gnu.org>
parents: 26700
diff changeset
36 ;; you do, information may be hidden from users who don't know it
b8145f3d528e Fix commentary.
Dave Love <fx@gnu.org>
parents: 26700
diff changeset
37 ;; already.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
38
26925
4364c74ee502 Comment.
Dave Love <fx@gnu.org>
parents: 26703
diff changeset
39 ;; Note that `hs-minor-mode' will do a similar job by default, but
4364c74ee502 Comment.
Dave Love <fx@gnu.org>
parents: 26703
diff changeset
40 ;; it's not selective about what leading commentary it hides.
4364c74ee502 Comment.
Dave Love <fx@gnu.org>
parents: 26703
diff changeset
41
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
42 ;; Inspired by jwz's hide-copyleft.el, for which we don't have an
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
43 ;; assignment.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
44
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
45 ;;; Code:
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
46
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
47 (defgroup elide-head nil
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
48 "Eliding copyright headers and the like in source files."
27125
4b3c83c489cf (elide-head): Add :version.
Dave Love <fx@gnu.org>
parents: 26925
diff changeset
49 :version "21.1"
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
50 :prefix "elide-head"
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
51 :group 'tools)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
52
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
53 (defcustom elide-head-headers-to-hide
95070
e7c3af7f57eb (elide-head-headers-to-hide): Handle GPLv3 format.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
54 '(("is free software[:;] you can redistribute it" . ; GNU boilerplate
e7c3af7f57eb (elide-head-headers-to-hide): Handle GPLv3 format.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
55 "\\(Boston, MA 0211\\(1-1307\\|0-1301\\), USA\\|\
e7c3af7f57eb (elide-head-headers-to-hide): Handle GPLv3 format.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
56 If not, see <http://www\\.gnu\\.org/licenses/>\\)\\.")
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
57 ("The Regents of the University of California\\. All rights reserved\\." .
64130
6e6a8d280410 (elide-head-headers-to-hide): Recognize the FSF's new address as well.
Lute Kamstra <lute@gnu.org>
parents: 64091
diff changeset
58 "SUCH DAMAGE\\.") ; BSD
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
59 ("Permission is hereby granted, free of charge" . ; X11
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
60 "authorization from the X Consortium\\."))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
61 "Alist of regexps defining start end end of text to elide.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
62
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
63 The cars of elements of the list are searched for in order. Text is
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
64 elided with an invisible overlay from the end of the line where the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
65 first match is found to the end of the match for the corresponding
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
66 cdr."
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
67 :group 'elide-head
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
68 :type '(alist :key-type (string :tag "Start regexp")
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
69 :value-type (string :tag "End regexp")))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
70
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
71 (defvar elide-head-overlay nil)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
72 (make-variable-buffer-local 'elide-head-overlay)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
73
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
74 ;;;###autoload
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
75 (defun elide-head (&optional arg)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
76 "Hide header material in buffer according to `elide-head-headers-to-hide'.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
77
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
78 The header is made invisible with an overlay. With a prefix arg, show
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
79 an elided material again.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
80
46899
f00337f04e78 Use find-file-hook instead of find-file-hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38436
diff changeset
81 This is suitable as an entry on `find-file-hook' or appropriate mode hooks."
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
82 (interactive "P")
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
83 (if arg
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
84 (elide-head-show)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
85 (save-excursion
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
86 (save-restriction
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
87 (let ((rest elide-head-headers-to-hide)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
88 beg end)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
89 (widen)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
90 (goto-char (point-min))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
91 (while rest
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
92 (save-excursion
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
93 (when (re-search-forward (caar rest) nil t)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
94 (setq beg (point))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
95 (when (re-search-forward (cdar rest) nil t)
27264
7c1aca21377a (elide-head): Use point-marker, not point.
Dave Love <fx@gnu.org>
parents: 27125
diff changeset
96 (setq end (point-marker)
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
97 rest nil))))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
98 (if rest (setq rest (cdr rest))))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
99 (if (not (and beg end))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
100 (if (interactive-p)
57751
d2b6a6d18cc9 (elide-head): Change error to message.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
101 (message "No header found"))
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
102 (goto-char beg)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
103 (end-of-line)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
104 (if (overlayp elide-head-overlay)
27264
7c1aca21377a (elide-head): Use point-marker, not point.
Dave Love <fx@gnu.org>
parents: 27125
diff changeset
105 (move-overlay elide-head-overlay (point-marker) end)
27578
e3f24c47fbcd (elide-head): Use point-marker more.
Dave Love <fx@gnu.org>
parents: 27264
diff changeset
106 (setq elide-head-overlay (make-overlay (point-marker) end)))
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
107 (overlay-put elide-head-overlay 'invisible t)
35701
96fb197c6aff (elide-head): Make overlay evaporate.
Dave Love <fx@gnu.org>
parents: 27578
diff changeset
108 (overlay-put elide-head-overlay 'evaporate t)
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
109 (overlay-put elide-head-overlay 'after-string "...")))))))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
110
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
111 (defun elide-head-show ()
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
112 "Show a header elided current buffer by \\[elide-head]."
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
113 (interactive)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
114 (if (and (overlayp elide-head-overlay)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
115 (overlay-buffer elide-head-overlay))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
116 (delete-overlay elide-head-overlay)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
117 (if (interactive-p)
57751
d2b6a6d18cc9 (elide-head): Change error to message.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
118 (message "No header hidden"))))
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
119
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
120 (provide 'elide-head)
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
121
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79721
diff changeset
122 ;; arch-tag: a00e6b5b-6aeb-45b1-b734-63e23df80928
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
123 ;;; elide-head.el ends here