From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: 23.0.50; Footnote-add-footnote and more condensed style Date: Sat, 02 Feb 2008 20:57:33 +0100 Message-ID: <47A4CB2D.5090408@gmx.at> References: <87ejc4j1i7.fsf@ID-24456.user.uni-berlin.de> <479B51C9.9060104@gmx.at> <47A212AB.5050804@gmx.at> <87myql4su3.fsf@ID-24456.user.uni-berlin.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010407060406050208030408" X-Trace: ger.gmane.org 1201982337 16717 80.91.229.12 (2 Feb 2008 19:58:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2008 19:58:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: Christoph Conrad Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 02 20:59:18 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JLOWD-0005EF-5M for ged-emacs-devel@m.gmane.org; Sat, 02 Feb 2008 20:59:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLOVl-0004KY-Gw for ged-emacs-devel@m.gmane.org; Sat, 02 Feb 2008 14:58:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JLOVg-0004Iu-Vl for emacs-devel@gnu.org; Sat, 02 Feb 2008 14:58:45 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JLOVf-0004H5-IR for emacs-devel@gnu.org; Sat, 02 Feb 2008 14:58:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLOVf-0004Gj-9N for emacs-devel@gnu.org; Sat, 02 Feb 2008 14:58:43 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JLOVe-0002KP-FM for emacs-devel@gnu.org; Sat, 02 Feb 2008 14:58:43 -0500 Original-Received: (qmail invoked by alias); 02 Feb 2008 19:58:41 -0000 Original-Received: from N926P010.adsl.highway.telekom.at (EHLO [62.47.59.170]) [62.47.59.170] by mail.gmx.net (mp043) with SMTP; 02 Feb 2008 20:58:41 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18bXtEYxPobKgstk7m6k4km7bnP+zbc7sg9F8lEn3 W1zXmqVA2s1rV1 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <87myql4su3.fsf@ID-24456.user.uni-berlin.de> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88051 Archived-At: This is a multi-part message in MIME format. --------------010407060406050208030408 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > "Really needed", not in that sense. But it is a lot nicer to have > beautifully condensed footnotes without at least two linefeeds between. OK, try the attached patch (against the trunk) and customize `footnote-section-tag' to nil. Observe that I can't guarantee for anything here. The footnote code is hopelessly broken if not used with the default values. Just for fun: Before applying the patch set `footnote-spaced-footnotes' to nil, add a footnote, and try to delete it with `footnote-delete-footnote'. --------------010407060406050208030408 Content-Type: text/plain; name="footnote.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="footnote.patch" *** mail/footnote.el Thu Jan 10 19:25:58 2008 --- mail/footnote.el Sat Feb 2 20:43:08 2008 *************** *** 48,68 **** :group 'message) (defcustom footnote-mode-line-string " FN" ! "*String to display in modes section of the mode-line." :group 'footnote) (defcustom footnote-mode-hook nil ! "*Hook functions run when footnote-mode is activated." :type 'hook :group 'footnote) (defcustom footnote-narrow-to-footnotes-when-editing nil ! "*If set, narrow to footnote text body while editing a footnote." :type 'boolean :group 'footnote) (defcustom footnote-prompt-before-deletion t ! "*If set, prompt before deleting a footnote. There is currently no way to undo deletions." :type 'boolean :group 'footnote) --- 48,68 ---- :group 'message) (defcustom footnote-mode-line-string " FN" ! "String to display in modes section of the mode-line." :group 'footnote) (defcustom footnote-mode-hook nil ! "Hook functions run when footnote-mode is activated." :type 'hook :group 'footnote) (defcustom footnote-narrow-to-footnotes-when-editing nil ! "If set, narrow to footnote text body while editing a footnote." :type 'boolean :group 'footnote) (defcustom footnote-prompt-before-deletion t ! "If set, prompt before deleting a footnote. There is currently no way to undo deletions." :type 'boolean :group 'footnote) *************** *** 74,85 **** :group 'footnote) (defcustom footnote-use-message-mode t ! "*If non-nil assume Footnoting will be done in message-mode." :type 'boolean :group 'footnote) (defcustom footnote-body-tag-spacing 2 ! "*Number of blanks separating a footnote body tag and its text." :type 'integer :group 'footnote) --- 74,85 ---- :group 'footnote) (defcustom footnote-use-message-mode t ! "If non-nil assume Footnoting will be done in message-mode." :type 'boolean :group 'footnote) (defcustom footnote-body-tag-spacing 2 ! "Number of blanks separating a footnote body tag and its text." :type 'integer :group 'footnote) *************** *** 89,120 **** ;;; Interface variables that probably shouldn't be changed (defcustom footnote-section-tag "Footnotes: " ! "*Tag inserted at beginning of footnote section." ! :version "22.1" ! :type 'string :group 'footnote) (defcustom footnote-section-tag-regexp "Footnotes\\(\\[.\\]\\)?: " ! "*Regexp which indicates the start of a footnote section. ! See also `footnote-section-tag'." :type 'regexp :group 'footnote) ;; The following three should be consumed by footnote styles. (defcustom footnote-start-tag "[" ! "*String used to denote start of numbered footnote." :type 'string :group 'footnote) (defcustom footnote-end-tag "]" ! "*String used to denote end of numbered footnote." :type 'string :group 'footnote) (defvar footnote-signature-separator (if (boundp 'message-signature-separator) message-signature-separator "^-- $") ! "*String used to recognize .signatures.") ;;; Private variables --- 89,122 ---- ;;; Interface variables that probably shouldn't be changed (defcustom footnote-section-tag "Footnotes: " ! "Tag inserted at beginning of footnote section. ! If you set this to nil no section tag is inserted and the value ! of `footnote-section-tag-regexp' is disregarded." ! :version "23.1" ! :type '(choice (const :tag "None" nil) string) :group 'footnote) (defcustom footnote-section-tag-regexp "Footnotes\\(\\[.\\]\\)?: " ! "Regexp which indicates the start of a footnote section. ! This variable is disregarded when `footnote-section-tag' is nil." :type 'regexp :group 'footnote) ;; The following three should be consumed by footnote styles. (defcustom footnote-start-tag "[" ! "String used to denote start of numbered footnote." :type 'string :group 'footnote) (defcustom footnote-end-tag "]" ! "String used to denote end of numbered footnote." :type 'string :group 'footnote) (defvar footnote-signature-separator (if (boundp 'message-signature-separator) message-signature-separator "^-- $") ! "String used to recognize .signatures.") ;;; Private variables *************** *** 295,301 **** exciting styles.") (defcustom footnote-style 'numeric ! "*Default style used for footnoting. numeric == 1, 2, 3, ... english-lower == a, b, c, ... english-upper == A, B, C, ... --- 297,303 ---- exciting styles.") (defcustom footnote-style 'numeric ! "Default style used for footnoting. numeric == 1, 2, 3, ... english-lower == a, b, c, ... english-upper == A, B, C, ... *************** *** 455,462 **** (goto-char (point-max)) (when (re-search-backward footnote-signature-separator nil t) (let ((end (point))) ! (when (re-search-backward (concat "^" footnote-section-tag-regexp) nil t) ! (narrow-to-region (point) end))))) (defun Footnote-goto-char-point-max () "Move to end of buffer or prior to start of .signature." --- 457,467 ---- (goto-char (point-max)) (when (re-search-backward footnote-signature-separator nil t) (let ((end (point))) ! (cond ! ((not footnote-section-tag) ! (narrow-to-region (cdar footnote-text-marker-alist) end)) ! ((re-search-backward (concat "^" footnote-section-tag-regexp) nil t) ! (narrow-to-region (point) end)))))) (defun Footnote-goto-char-point-max () "Move to end of buffer or prior to start of .signature." *************** *** 465,471 **** (point))) (defun Footnote-insert-text-marker (arg locn) ! "Insert a marker pointing to footnote arg, at buffer location locn." (let ((marker (make-marker))) (unless (assq arg footnote-text-marker-alist) (set-marker marker locn) --- 470,476 ---- (point))) (defun Footnote-insert-text-marker (arg locn) ! "Insert a marker pointing to footnote ARG, at buffer location LOCN." (let ((marker (make-marker))) (unless (assq arg footnote-text-marker-alist) (set-marker marker locn) *************** *** 475,481 **** (Footnote-sort footnote-text-marker-alist))))) (defun Footnote-insert-pointer-marker (arg locn) ! "Insert a marker pointing to footnote arg, at buffer location locn." (let ((marker (make-marker)) alist) (set-marker marker locn) --- 480,486 ---- (Footnote-sort footnote-text-marker-alist))))) (defun Footnote-insert-pointer-marker (arg locn) ! "Insert a marker pointing to footnote ARG, at buffer location LOCN." (let ((marker (make-marker)) alist) (set-marker marker locn) *************** *** 488,499 **** (Footnote-sort footnote-pointer-marker-alist))))) (defun Footnote-insert-footnote (arg) ! "Insert a footnote numbered arg, at (point)." (push-mark) (Footnote-insert-pointer-marker arg (point)) (Footnote-insert-numbered-footnote arg t) (Footnote-goto-char-point-max) ! (if (re-search-backward (concat "^" footnote-section-tag-regexp) nil t) (save-restriction (when footnote-narrow-to-footnotes-when-editing (Footnote-narrow-to-footnotes)) --- 493,507 ---- (Footnote-sort footnote-pointer-marker-alist))))) (defun Footnote-insert-footnote (arg) ! "Insert a footnote numbered ARG, at (point)." (push-mark) (Footnote-insert-pointer-marker arg (point)) (Footnote-insert-numbered-footnote arg t) (Footnote-goto-char-point-max) ! (if (cond (footnote-section-tag ! (re-search-backward (concat "^" footnote-section-tag-regexp) nil t)) ! (footnote-text-marker-alist ! (goto-char (cdar footnote-text-marker-alist)))) (save-restriction (when footnote-narrow-to-footnotes-when-editing (Footnote-narrow-to-footnotes)) *************** *** 511,522 **** nil t) (unless (beginning-of-line) t)) (Footnote-goto-char-point-max) ! (re-search-backward (concat "^" footnote-section-tag-regexp) nil t)))) (unless (looking-at "^$") (insert "\n")) (when (eobp) (insert "\n")) ! (insert footnote-section-tag "\n")) (let ((old-point (point))) (Footnote-insert-numbered-footnote arg nil) (Footnote-insert-text-marker arg old-point))) --- 519,536 ---- nil t) (unless (beginning-of-line) t)) (Footnote-goto-char-point-max) ! (cond ! (footnote-section-tag ! (re-search-backward ! (concat "^" footnote-section-tag-regexp) nil t)) ! (footnote-text-marker-alist ! (goto-char (cdar footnote-text-marker-alist))))))) (unless (looking-at "^$") (insert "\n")) (when (eobp) (insert "\n")) ! (when footnote-section-tag ! (insert footnote-section-tag "\n"))) (let ((old-point (point))) (Footnote-insert-numbered-footnote arg nil) (Footnote-insert-text-marker arg old-point))) *************** *** 579,585 **** (setq i (1+ i))) rc))) ! (defun Footnote-add-footnote (&optional arg) "Add a numbered footnote. The number the footnote receives is dependent upon the relative location of any other previously existing footnotes. --- 593,599 ---- (setq i (1+ i))) rc))) ! (defun Footnote-add-footnote (&optional arg) ; what is ARG needed for ??? "Add a numbered footnote. The number the footnote receives is dependent upon the relative location of any other previously existing footnotes. *************** *** 610,616 **** (defun Footnote-delete-footnote (&optional arg) "Delete a numbered footnote. ! With no parameter, delete the footnote under (point). With arg specified, delete the footnote with that number." (interactive "*P") (unless arg --- 624,630 ---- (defun Footnote-delete-footnote (&optional arg) "Delete a numbered footnote. ! With no parameter, delete the footnote under (point). With ARG specified, delete the footnote with that number." (interactive "*P") (unless arg *************** *** 629,639 **** (goto-char (car locn)) (let* ((end (point)) (start (search-backward footnote-start-tag nil t))) ! (kill-region start end))) (setq locn (cdr locn))) (save-excursion (goto-char (cdr alist-txt)) ! (kill-region (point) (search-forward "\n\n" nil t))) (setq footnote-pointer-marker-alist (delq alist-ptr footnote-pointer-marker-alist)) (setq footnote-text-marker-alist --- 643,661 ---- (goto-char (car locn)) (let* ((end (point)) (start (search-backward footnote-start-tag nil t))) ! (delete-region start end))) (setq locn (cdr locn))) (save-excursion (goto-char (cdr alist-txt)) ! (delete-region ! (point) ! (if footnote-spaced-footnotes ! ;; This might fail miserably when there's no such string. ! (search-forward "\n\n" nil t) ! (save-restriction ! (end-of-line) ! (next-single-char-property-change ! (point) 'footnote-number nil (Footnote-goto-char-point-max)))))) (setq footnote-pointer-marker-alist (delq alist-ptr footnote-pointer-marker-alist)) (setq footnote-text-marker-alist *************** *** 642,657 **** (when (and (null footnote-text-marker-alist) (null footnote-pointer-marker-alist)) (save-excursion ! (let* ((end (Footnote-goto-char-point-max)) ! (start (1- (re-search-backward ! (concat "^" footnote-section-tag-regexp) ! nil t)))) ! (forward-line -1) ! (when (looking-at "\n") ! (kill-line)) ! (kill-region start (if (< end (point-max)) ! end ! (point-max))))))))) (defun Footnote-renumber-footnotes (&optional arg) "Renumber footnotes, starting from 1." --- 664,683 ---- (when (and (null footnote-text-marker-alist) (null footnote-pointer-marker-alist)) (save-excursion ! (if footnote-section-tag ! (let* ((end (Footnote-goto-char-point-max)) ! (start (1- (re-search-backward ! (concat "^" footnote-section-tag-regexp) ! nil t)))) ! (forward-line -1) ! (when (looking-at "\n") ! (kill-line)) ! (delete-region start (if (< end (point-max)) ! end ; ??? ! (point-max)))) ! (Footnote-goto-char-point-max) ! (when (looking-back "\n\n") ! (kill-line -1)))))))) (defun Footnote-renumber-footnotes (&optional arg) "Renumber footnotes, starting from 1." *************** *** 682,689 **** (if (eq arg 0) (progn (goto-char (point-max)) ! (re-search-backward (concat "^" footnote-section-tag-regexp)) ! (forward-line 1)) (error "I don't see a footnote here"))))) (defun Footnote-back-to-message (&optional arg) --- 708,718 ---- (if (eq arg 0) (progn (goto-char (point-max)) ! (cond (footnote-section-tag ! (re-search-backward (concat "^" footnote-section-tag-regexp)) ! (forward-line 1)) ! (footnote-text-marker-alist ! (goto-char (cdar footnote-text-marker-alist))))) (error "I don't see a footnote here"))))) (defun Footnote-back-to-message (&optional arg) --------------010407060406050208030408--