]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/two-column.el
Switch license to GPLv3 or later.
[gnu-emacs] / lisp / textmodes / two-column.el
index 9452a4f9e54b02e11fa29e33f5ecd891fca65939..2568b53fe36e84145e79f374bf2f3780fe7719c8 100644 (file)
@@ -1,9 +1,13 @@
 ;;; two-column.el --- minor mode for editing of two-column text
 
-;; Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
-;; Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389
+;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Adapted-By: ESR, Daniel Pfeiffer
+;; Keywords: wp
+
+;; This file is part of GNU Emacs.
 
 ;; Esperanto:                           English:
 
@@ -14,7 +18,7 @@
 ;; ^gin sub  la  kondi^coj  de  la  GNU         under the terms of the GNU General
 ;; ^Generala  Publika Licenco kiel pub-         Public License as published by the
 ;; likigita far la Liberprogramara Fon-         Free Software Foundation; either
-;; da^jo; a^u eldono 2a,  a^u (la^u via         version 2, or (at your option) any
+;; da^jo; a^u eldono 2a,  a^u (la^u via         version 3, or (at your option) any
 ;; elekto) ajna posta eldono.           later version.
 
 ;; GNU  Emacs  estas  disdonata  en  la         GNU Emacs is distributed in the hope
 ;; GNU Emacs; vidu la dosieron COPYING.         with GNU Emacs; see the file
 ;; Alikaze skribu al la                         COPYING.  If not, write to the
 
-;; Free Software Foundation, 59 Temple Place - Suite 330
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, 51 Franklin Street, Fifth Floor
+;; Boston, MA 02110-1301, USA.
 
+;;; Commentary:
 
 ;;; Komentario:                                 Commentary:
 
 ;;;###autoload (autoload '2C-command "two-column" () t 'keymap)
 (fset '2C-command 2C-mode-map)
 
-;;;###autoload
 ;; This one is for historical reasons and simple keyboards, it is not
 ;; at all mnemonic.  All usual sequences containing 2 were used, and
 ;; f2 could not be set up in a standard way under Emacs 18.
-(global-set-key "\C-x6" '2C-command)
+;;;###autoload (global-set-key "\C-x6" '2C-command)
 
-
-;;;###autoload
-(global-set-key [f2] '2C-command)
+;;;###autoload (global-set-key [f2] '2C-command)
 
 
 (defvar 2C-minor-mode-map
 \f
 ;;;;; variable declarations ;;;;;
 
+(defgroup two-column nil
+  "Minor mode for editing of two-column text."
+  :prefix "2C-"
+  :group 'frames)
+
+
 ;; Markers seem to be the only buffer-id not affected by renaming a buffer.
 ;; This nevertheless loses when a buffer is killed.  The variable-name is
 ;; required by `describe-mode'.
 
 
 ;; rearranged, so that the pertinent info will show in 40 columns
-(defvar 2C-mode-line-format
+(defcustom 2C-mode-line-format
        '("-%*- %15b --"  (-3 . "%p")  "--%[("  mode-name
          minor-mode-alist  "%n"  mode-line-process  ")%]%-")
-  "*Value of mode-line-format for a buffer in two-column minor mode.")
+  "*Value of `mode-line-format' for a buffer in two-column minor mode."
+  :type 'sexp
+  :group 'two-column)
 
 
-(defvar 2C-other-buffer-hook 'text-mode
-  "*Hook run in new buffer when it is associated with current one.")
+(defcustom 2C-other-buffer-hook 'text-mode
+  "*Hook run in new buffer when it is associated with current one."
+  :type 'function
+  :group 'two-column)
 
 
-(defvar 2C-separator ""
+(defcustom 2C-separator ""
   "*A string inserted between the two columns when merging.
-This gets set locally by \\[2C-split].")
+This gets set locally by \\[2C-split]."
+  :type 'string
+  :group 'two-column)
 (put '2C-separator 'permanent-local t)
 
 
 
-(defvar 2C-window-width 40
+(defcustom 2C-window-width 40
   "*The width of the first column.  (Must be at least `window-min-width')
-This value is local for every buffer that sets it.")
+This value is local for every buffer that sets it."
+  :type 'integer
+  :group 'two-column)
 (make-variable-buffer-local '2C-window-width)
 (put '2C-window-width 'permanent-local t)
 
 
 
-(defvar 2C-beyond-fill-column 4
+(defcustom 2C-beyond-fill-column 4
   "*Base for calculating `fill-column' for a buffer in two-column minor mode.
 The value of `fill-column' becomes `2C-window-width' for this buffer
-minus this value.")
+minus this value."
+  :type 'integer
+  :group 'two-column)
 
 
 
-(defvar 2C-autoscroll t
-  "If non-nil, Emacs attempts to keep the two column's buffers aligned.")
+(defcustom 2C-autoscroll t
+  "If non-nil, Emacs attempts to keep the two column's buffers aligned."
+  :type 'boolean
+  :group 'two-column)
 
 
 
@@ -269,7 +289,7 @@ minus this value.")
                (kill-local-variable '2C-mode)
                (kill-local-variable 'mode-line-format)
                nil)))
-      (if req (error "You must first set two-column minor mode."))))
+      (if req (error "You must first set two-column minor mode"))))
 
 
 
@@ -308,7 +328,6 @@ These keybindings can be customized in your ~/.emacs by `2C-mode-map',
 The appearance of the screen can be customized by the variables
 `2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and
 `truncate-partial-width-windows'."
-  (make-local-hook 'post-command-hook)
   (add-hook 'post-command-hook '2C-autoscroll nil t)
   (setq fill-column (- 2C-window-width
                       2C-beyond-fill-column)
@@ -321,11 +340,11 @@ The appearance of the screen can be customized by the variables
 ;;;###autoload
 (defun 2C-two-columns (&optional buffer)
   "Split current window vertically for two-column editing.
-When called the first time, associates a buffer with the current
-buffer in two-column minor mode (see  \\[describe-mode] ).
-Runs `2C-other-buffer-hook' in the new buffer.
+\\<global-map>When called the first time, associates a buffer with the current
+buffer in two-column minor mode (use \\[describe-mode] once in the mode,
+for details.).  It runs `2C-other-buffer-hook' in the new buffer.
 When called again, restores the screen layout with the current buffer
-first and the associated buffer to it's right."
+first and the associated buffer to its right."
   (interactive "P")
   ;; first go to full width, so that we can certainly split into two windows
   (if (< (window-width) (frame-width))
@@ -348,7 +367,7 @@ first and the associated buffer to it's right."
                    (generate-new-buffer (concat "2C/" (buffer-name)))))
               (or buffer
                   (run-hooks '2C-other-buffer-hook))))
-    
+
     (2C-mode (prog1 (point-marker)
               (other-window -1)))))
 
@@ -370,7 +389,7 @@ accepting the proposed default buffer.
       (set-buffer b2)
       (and (2C-other)
           (not (eq b1 (2C-other)))
-          (error "Buffer already associated with buffer `%s'."
+          (error "Buffer already associated with buffer `%s'"
                  (buffer-name (2C-other))))
       (setq b1 (and (assq '2C-window-width (buffer-local-variables))
                    2C-window-width)))
@@ -488,7 +507,7 @@ this one, then this one becomes the left column.
 
 If you want `2C-separator' on empty lines in the second column,
 you should put just one space in them.  In the final result, you can strip
-off trailing spaces with \\[beginning-of-buffer] \\[replace-regexp] [ SPC TAB ] + $ RET RET"
+off trailing spaces with \\[delete-trailing-whitespace]."
   (interactive)
   (and (> (car (window-edges)) 0)      ; not touching left edge of screen
        (eq (window-buffer (previous-window))
@@ -621,4 +640,5 @@ When autoscrolling is turned on, this also realigns the two buffers."
 
 (provide 'two-column)
 
+;;; arch-tag: 2021b5ab-d3a4-4a8c-a21c-1936b0f9e6b1
 ;;; two-column.el ends here