unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Christoph Conrad <christoph.conrad@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: 23.0.50; Footnote-add-footnote and more condensed style
Date: Sat, 02 Feb 2008 20:57:33 +0100	[thread overview]
Message-ID: <47A4CB2D.5090408@gmx.at> (raw)
In-Reply-To: <87myql4su3.fsf@ID-24456.user.uni-berlin.de>

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

 > "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'.

[-- Attachment #2: footnote.patch --]
[-- Type: text/plain, Size: 13186 bytes --]

*** 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)

  reply	other threads:[~2008-02-02 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-26 10:55 23.0.50; Footnote-add-footnote and more condensed style Christoph Conrad
2008-01-26 15:29 ` martin rudalics
2008-01-31 11:39   ` Christoph Conrad
2008-01-31 18:25     ` martin rudalics
2008-01-31 20:54       ` Christoph Conrad
2008-02-02 19:57         ` martin rudalics [this message]
2008-02-02 20:13           ` Christoph Conrad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47A4CB2D.5090408@gmx.at \
    --to=rudalics@gmx.at \
    --cc=christoph.conrad@gmx.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).