1992-07-17 06:48:03 +00:00
|
|
|
|
;;; two-column.el --- minor mode for editing of two-column text
|
|
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
|
;; Copyright (C) 1992-1995, 2001-2020 Free Software Foundation, Inc.
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1998-12-14 03:22:44 +00:00
|
|
|
|
;; Author: Daniel Pfeiffer <occitan@esperanto.org>
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; Adapted-By: ESR, Daniel Pfeiffer
|
2001-08-06 10:12:17 +00:00
|
|
|
|
;; Keywords: wp
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
2001-07-16 12:23:00 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 04:31:59 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
2001-07-16 12:23:00 +00:00
|
|
|
|
;;; Commentary:
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
|
|
|
|
;;; Komentario: Commentary:
|
|
|
|
|
|
|
|
|
|
;; Tiu programaro ebligas vin redakti This package gives you the ability
|
|
|
|
|
;; dukolumnan tekston. to edit text in a two-column format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Vi havas tri eblecojn por eki tiun You have three ways to start up this
|
|
|
|
|
;; mal^cefan modalon. ^Ciu donas al vi minor mode. Each gives you a
|
|
|
|
|
;; horizontale disigatan fenestron, si- horizontally split window similar to
|
|
|
|
|
;; milan al fina apareco de via teksto: the final outcome of your text:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; f2 2 asocias novan bufron nomatan associates a new buffer called
|
|
|
|
|
;; C-x 6 2 same, sed kun 2C/ anta^u. the same, but with 2C/
|
|
|
|
|
;; prepended.
|
|
|
|
|
|
|
|
|
|
;; f2 b asocias alian bufron. Vi povas associates another buffer.
|
|
|
|
|
;; C-x 6 b anka^u asocii dataron, se vi This can be used to associate a
|
|
|
|
|
;; ^jus anta^ue faris C-x C-f. file if you just did C-x C-f.
|
|
|
|
|
|
|
|
|
|
;; f2 s disigas jam dukolumnan tekston splits a two-column text into
|
|
|
|
|
;; C-x 6 s en du bufroj ekde la nuna two buffers from the current
|
|
|
|
|
;; linio, kaj je la nuna kolumno. line and at the current column.
|
|
|
|
|
;; La anta^uaj signoj (ofte The preceding characters (often
|
|
|
|
|
;; tabeligilo a^u |) estas la tab or |) are the column
|
|
|
|
|
;; kolumna disiganto. Linioj kiuj separator. Lines that don't
|
|
|
|
|
;; ne enhavas ilin ne estas have them won't be separated.
|
|
|
|
|
;; disigitaj. Kiel la kvara kaj Like the fourth and fifth line
|
|
|
|
|
;; la kvina linio se vi disigas if you split this file from
|
|
|
|
|
;; ^ci dataron ekde la unua angla the first english word.
|
|
|
|
|
;; vorto.
|
|
|
|
|
|
|
|
|
|
;; Se vi volas meti longajn liniojn If you include long lines, i.e which
|
|
|
|
|
;; (ekz. programerojn) en la kunigotan will span both columns (eg. source
|
|
|
|
|
;; tekston, ili devas esti en la code), they should be in what will
|
|
|
|
|
;; estonte unua kolumno. La alia devas be the first column, with the
|
|
|
|
|
;; havi vakajn linion apud ili. associated buffer having empty lines
|
|
|
|
|
;; next to them.
|
|
|
|
|
|
|
|
|
|
;; Averto: en Emacs kiam vi ^san^gas la Attention: in Emacs when you change
|
|
|
|
|
;; ^cefan modalon, la mal^cefaj modaloj the major mode, the minor modes are
|
|
|
|
|
;; estas anka^u elmemorigitaj. Tiu- also purged from memory. In that
|
|
|
|
|
;; okaze vi devas religi la du bufrojn case you must reassociate the two
|
|
|
|
|
;; per iu C-x 6-ordono, ekz. C-x 6 b. buffers with any C-x 6-command, e.g.
|
|
|
|
|
;; C-x 6 b.
|
|
|
|
|
|
|
|
|
|
;; Kiam vi estos kontenta de la When you have edited both buffers to
|
|
|
|
|
;; rezulto, vi kunmetos la du kolumnojn your content, you merge them with
|
|
|
|
|
;; per C-x 6 1. Se vi poste vidas C-x 6 1. If you then see a problem,
|
|
|
|
|
;; problemon, vi neniigu la kunmeton you undo the merge with C-x u and
|
|
|
|
|
;; per C-x u kaj plue modifu la du continue to edit the two buffers.
|
|
|
|
|
;; bufrojn. Kiam vi ne plu volas tajpi When you no longer want to edit in
|
|
|
|
|
;; dukolumne, vi eliru el la mal^cefa two columns, you turn off the minor
|
|
|
|
|
;; modalo per C-x 6 d. mode with C-x 6 d.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Aldone al dukolumna redaktado, ek- In addition to two-column editing of
|
|
|
|
|
;; zemple por skribi dulingvan tekston text, for example for writing a
|
|
|
|
|
;; flank-al-flanke kiel ^ci tiu, aliaj bilingual text side-by-side as shown
|
|
|
|
|
;; interesaj uzoj trovitas por tiu mal- here, other interesting uses have
|
|
|
|
|
;; ^cefa modalo: been found for this minor mode:
|
|
|
|
|
|
|
|
|
|
;; Vi povas disigi la kolumnojn per {+} You can separate the columns with
|
|
|
|
|
;; ajna pla^ca ^ceno starigante {+} any string that pleases you, by
|
|
|
|
|
;; `2C-separator'. Ekzemple "{+} " {+} setting `2C-separator'. For example
|
|
|
|
|
;; por amuzi^gi. f2 s a^u C-x 6 s {+} "{+} " if you'd like to have fun.
|
|
|
|
|
;; traktas tiujn kun prefiksa {+} f2 s or C-x 6 s handles these with a
|
|
|
|
|
;; argumento kiu signifas la longon {+} prefix argument that means the
|
|
|
|
|
;; de tia ^ceno. {+} desired length of such a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Programistoj eble ^satus la eblecon Programmers might like the ability
|
|
|
|
|
;; forspliti la komentarian kolumnon de to split off the comment column of a
|
|
|
|
|
;; dosiero kiel la sekvanta. Vi povas file that looks like the following.
|
|
|
|
|
;; rearan^gigi la paragrafon. La pro- You can fill-paragraph the comment.
|
|
|
|
|
;; blemo estas ke koda^jo tuj lar- The problem is, code quickly gets
|
|
|
|
|
;; ^gi^gas, tiel ke vi bezonas pli rather wide, so you need to use a
|
|
|
|
|
;; mallar^gan komentarian kolumnon. narrower comment column. Code lines
|
|
|
|
|
;; Koda^jaj linioj tra `comment-column' that reach beyond `comment-column'
|
|
|
|
|
;; ne problemas, krom ke vi ne vidos are no problem, except that you
|
|
|
|
|
;; iliajn finojn dum redaktado. won't see their end during editing.
|
|
|
|
|
|
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; BEGIN -- This is just some meaningless
|
|
|
|
|
;; FOR i IN 1..10 LOOP -- code in Ada, that runs foobar
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; foobar( i ); -- once for each argument from one
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; END LOOP; -- to ten, and then we're already
|
|
|
|
|
;; END; -- through with it.
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
|
|
|
|
;; Pli bone ankora^u, vi povas pozici- Better yet, you can put the point
|
|
|
|
|
;; i^gi anta^u "This", tajpi M-3 f2 s before "This", type M-3 f2 s
|
|
|
|
|
;; kiu igas "-- " la separigilon inter which makes "-- " the separator
|
|
|
|
|
;; senkomentaria Ada bufro kaj nur- between a no-comments Ada buffer,
|
|
|
|
|
;; teksta komentaria bufro. Kiam vi and a plain text comment buffer.
|
|
|
|
|
;; denove kuni^gos ilin, ^ciu nevaka When you put them back together,
|
|
|
|
|
;; linio de l' dua kolumno denove every non-empty line of the 2nd
|
|
|
|
|
;; anta^uhavos "-- ". column will again be preceded by
|
|
|
|
|
;; "-- ".
|
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(defgroup two-column nil
|
|
|
|
|
"Minor mode for editing of two-column text."
|
|
|
|
|
:prefix "2C-"
|
|
|
|
|
:group 'frames)
|
|
|
|
|
|
|
|
|
|
(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."
|
|
|
|
|
:type 'sexp
|
|
|
|
|
:group 'two-column)
|
|
|
|
|
|
|
|
|
|
(defcustom 2C-other-buffer-hook 'text-mode
|
|
|
|
|
"Hook run in new buffer when it is associated with current one."
|
|
|
|
|
:type 'function
|
|
|
|
|
:group 'two-column)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(defcustom 2C-separator ""
|
|
|
|
|
"A string inserted between the two columns when merging.
|
|
|
|
|
This gets set locally by \\[2C-split]."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'two-column)
|
|
|
|
|
(put '2C-separator 'permanent-local t)
|
|
|
|
|
|
|
|
|
|
(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."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'two-column)
|
|
|
|
|
(make-variable-buffer-local '2C-window-width)
|
|
|
|
|
(put '2C-window-width 'permanent-local t)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(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."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'two-column)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(defcustom 2C-autoscroll t
|
|
|
|
|
"If non-nil, Emacs attempts to keep the two column's buffers aligned."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'two-column)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2012-04-16 16:13:38 -04:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defvar 2C-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "2" '2C-two-columns)
|
|
|
|
|
(define-key map [f2] '2C-two-columns)
|
|
|
|
|
(define-key map "b" '2C-associate-buffer)
|
|
|
|
|
(define-key map "s" '2C-split)
|
|
|
|
|
map)
|
|
|
|
|
"Keymap for commands for setting up two-column mode.")
|
|
|
|
|
|
|
|
|
|
;;;###autoload (autoload '2C-command "two-column" () t 'keymap)
|
|
|
|
|
(fset '2C-command 2C-mode-map)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; 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.
|
2019-10-20 01:06:38 +03:00
|
|
|
|
;;;###autoload (global-set-key "\C-x6" '2C-command)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1998-06-01 03:03:00 +00:00
|
|
|
|
;;;###autoload (global-set-key [f2] '2C-command)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
|
|
|
|
(defvar 2C-minor-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "1" '2C-merge)
|
|
|
|
|
(define-key map "d" '2C-dissociate)
|
|
|
|
|
(define-key map "o" '2C-associated-buffer)
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(define-key map "\^m" '2C-newline)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(define-key map "|" '2C-toggle-autoscroll)
|
1995-11-03 03:11:24 +00:00
|
|
|
|
(define-key map "{" '2C-shrink-window-horizontally)
|
|
|
|
|
(define-key map "}" '2C-enlarge-window-horizontally)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for commands for use in two-column mode.")
|
|
|
|
|
|
|
|
|
|
(setq minor-mode-map-alist
|
|
|
|
|
(cons (cons '2C-mode
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(substitute-key-definition '2C-command 2C-minor-mode-map
|
|
|
|
|
map (current-global-map))
|
1995-11-03 03:11:24 +00:00
|
|
|
|
(substitute-key-definition 'enlarge-window-horizontally
|
|
|
|
|
'2C-enlarge-window-horizontally
|
|
|
|
|
map (current-global-map))
|
|
|
|
|
(substitute-key-definition 'shrink-window-horizontally
|
|
|
|
|
'2C-shrink-window-horizontally
|
|
|
|
|
map (current-global-map))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
map))
|
|
|
|
|
minor-mode-map-alist))
|
1997-04-13 03:09:23 +00:00
|
|
|
|
|
2012-04-16 16:13:38 -04:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; 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'.
|
|
|
|
|
(defvar 2C-mode nil
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Marker to the associated buffer, if non-nil.")
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(make-variable-buffer-local '2C-mode)
|
|
|
|
|
(put '2C-mode 'permanent-local t)
|
|
|
|
|
|
|
|
|
|
(setq minor-mode-alist (cons '(2C-mode " 2C") minor-mode-alist))
|
|
|
|
|
|
|
|
|
|
(defvar 2C-autoscroll-start nil)
|
|
|
|
|
(make-variable-buffer-local '2C-autoscroll-start)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;;;; base functions ;;;;;
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; The access method for the other buffer. This tries to remedy against
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; lost local variables and lost buffers.
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(defun 2C-other (&optional req)
|
|
|
|
|
(or (if 2C-mode
|
|
|
|
|
(or (prog1
|
|
|
|
|
(marker-buffer 2C-mode)
|
|
|
|
|
(setq mode-line-format 2C-mode-line-format))
|
|
|
|
|
;; The associated buffer somehow got killed.
|
|
|
|
|
(progn
|
|
|
|
|
;; The other variables may later be useful if the user
|
|
|
|
|
;; reestablishes the association.
|
|
|
|
|
(kill-local-variable '2C-mode)
|
|
|
|
|
(kill-local-variable 'mode-line-format)
|
|
|
|
|
nil)))
|
2001-07-16 12:23:00 +00:00
|
|
|
|
(if req (error "You must first set two-column minor mode"))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; function for setting up two-column minor mode in a buffer associated
|
|
|
|
|
;; with the buffer pointed to by the marker other.
|
|
|
|
|
(defun 2C-mode (other)
|
|
|
|
|
"Minor mode for independently editing two columns.
|
|
|
|
|
This is set up for two associated buffers by the three commands bound
|
|
|
|
|
to \\[2C-two-columns] , \\[2C-associate-buffer] and \\[2C-split].
|
|
|
|
|
Turning on two-column mode calls the value of the variable `2C-mode-hook',
|
|
|
|
|
if that value is non-nil.
|
|
|
|
|
|
|
|
|
|
These buffers can be edited separately, for example with `fill-paragraph'.
|
|
|
|
|
If you want to disable parallel scrolling temporarily, use \\[2C-toggle-autoscroll] .
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2013-02-12 09:36:54 -08:00
|
|
|
|
If you include long lines that span both columns (e.g., source
|
|
|
|
|
code), they should be in what will be the first column, with the
|
|
|
|
|
associated buffer having empty lines next to them.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
Potential uses are writing bilingual texts, or editing the comments of a
|
|
|
|
|
source code. See the file lisp/two-column.el for detailed examples.
|
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
You have the following commands at your disposal:
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
\\[2C-two-columns] Rearrange screen with current buffer first
|
|
|
|
|
\\[2C-associate-buffer] Reassociate buffer after changing major mode
|
1992-07-17 06:48:03 +00:00
|
|
|
|
\\[shrink-window-horizontally], \\[enlarge-window-horizontally] Shrink, enlarge current column
|
1995-08-01 22:42:28 +00:00
|
|
|
|
\\[2C-associated-buffer] Switch to associated buffer at same point
|
|
|
|
|
\\[2C-newline] Insert newline(s) in both buffers at same point
|
1995-07-07 20:01:01 +00:00
|
|
|
|
\\[2C-merge] Merge both buffers
|
|
|
|
|
\\[2C-dissociate] Dissociate the two buffers
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2012-09-17 13:41:04 +08:00
|
|
|
|
These keybindings can be customized in your init file by
|
|
|
|
|
`2C-mode-map', `2C-minor-mode-map' and by binding `2C-command' to
|
|
|
|
|
some prefix.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
The appearance of the screen can be customized by the variables
|
1995-07-07 20:01:01 +00:00
|
|
|
|
`2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and
|
|
|
|
|
`truncate-partial-width-windows'."
|
1995-08-22 20:55:36 +00:00
|
|
|
|
(add-hook 'post-command-hook '2C-autoscroll nil t)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(setq fill-column (- 2C-window-width
|
|
|
|
|
2C-beyond-fill-column)
|
|
|
|
|
mode-line-format 2C-mode-line-format
|
|
|
|
|
2C-mode other)
|
|
|
|
|
(run-hooks '2C-mode-hook))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun 2C-two-columns (&optional buffer)
|
|
|
|
|
"Split current window vertically for two-column editing.
|
2006-10-08 19:59:01 +00:00
|
|
|
|
\\<global-map>When called the first time, associates a buffer with the current
|
2006-10-09 15:08:13 +00:00
|
|
|
|
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.
|
1995-07-07 20:01:01 +00:00
|
|
|
|
When called again, restores the screen layout with the current buffer
|
1996-10-12 02:31:48 +00:00
|
|
|
|
first and the associated buffer to its right."
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(interactive "P")
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; first go to full width, so that we can certainly split into two windows
|
2007-08-08 06:04:51 +00:00
|
|
|
|
(unless (window-full-width-p)
|
|
|
|
|
(enlarge-window 99999 t))
|
2011-10-30 09:56:03 +08:00
|
|
|
|
(split-window-right
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(max window-min-width (min 2C-window-width
|
1992-09-28 13:02:35 +00:00
|
|
|
|
(- (frame-width) window-min-width))))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(if (2C-other)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(progn
|
|
|
|
|
(other-window 1)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(switch-to-buffer (2C-other))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(other-window -1)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(if 2C-autoscroll
|
|
|
|
|
(2C-toggle-autoscroll t)))
|
|
|
|
|
|
|
|
|
|
(2C-mode (prog1 (point-marker)
|
|
|
|
|
(other-window 1)
|
|
|
|
|
(switch-to-buffer
|
|
|
|
|
(or buffer
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(generate-new-buffer (concat "2C/" (buffer-name)))))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(or buffer
|
|
|
|
|
(run-hooks '2C-other-buffer-hook))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(2C-mode (prog1 (point-marker)
|
|
|
|
|
(other-window -1)))))
|
|
|
|
|
|
|
|
|
|
|
1993-02-22 14:16:48 +00:00
|
|
|
|
;;;###autoload
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defun 2C-associate-buffer ()
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Associate another buffer with this one in two-column minor mode.
|
|
|
|
|
Can also be used to associate a just previously visited file, by
|
|
|
|
|
accepting the proposed default buffer.
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
\(See \\[describe-mode] .)"
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((b1 (current-buffer))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(b2 (or (2C-other)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(read-buffer "Associate buffer: " (other-buffer)))))
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(setq 2C-mode nil)
|
|
|
|
|
(with-current-buffer b2
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(and (2C-other)
|
|
|
|
|
(not (eq b1 (2C-other)))
|
2001-07-16 12:23:00 +00:00
|
|
|
|
(error "Buffer already associated with buffer `%s'"
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(buffer-name (2C-other))))
|
|
|
|
|
(setq b1 (and (assq '2C-window-width (buffer-local-variables))
|
|
|
|
|
2C-window-width)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
; if other buffer has a local width, adjust here too
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(if b1 (setq 2C-window-width (- (frame-width) b1)))
|
|
|
|
|
(2C-two-columns b2)))
|
|
|
|
|
|
2013-09-17 21:42:43 -04:00
|
|
|
|
(autoload 'scroll-bar-columns "scroll-bar")
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(require 'fringe)) ; fringe-columns defsubst
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1993-02-22 14:16:48 +00:00
|
|
|
|
;;;###autoload
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defun 2C-split (arg)
|
|
|
|
|
"Split a two-column text at point, into two buffers in two-column minor mode.
|
|
|
|
|
Point becomes the local value of `2C-window-width'. Only lines that
|
|
|
|
|
have the ARG same preceding characters at that column get split. The
|
|
|
|
|
ARG preceding characters without any leading whitespace become the local
|
|
|
|
|
value for `2C-separator'. This way lines that continue across both
|
1992-07-17 06:48:03 +00:00
|
|
|
|
columns remain untouched in the first buffer.
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
This function can be used with a prototype line, to set up things. You
|
|
|
|
|
write the first line of each column and then split that line. E.g.:
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
First column's text sSs Second column's text
|
1992-07-17 06:48:03 +00:00
|
|
|
|
\\___/\\
|
|
|
|
|
/ \\
|
1995-07-07 20:01:01 +00:00
|
|
|
|
5 character Separator You type M-5 \\[2C-split] with the point here.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
\(See \\[describe-mode] .)"
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(and (2C-other)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(if (y-or-n-p (format-message "Overwrite associated buffer `%s'? "
|
2015-08-30 22:53:21 -07:00
|
|
|
|
(buffer-name (2C-other))))
|
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
|
|
|
|
(with-current-buffer (2C-other)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(erase-buffer))
|
|
|
|
|
(signal 'quit nil)))
|
|
|
|
|
(let ((point (point))
|
2009-06-04 01:11:06 +00:00
|
|
|
|
;; make next-line always come back to same column
|
|
|
|
|
(column (current-column))
|
|
|
|
|
;; a counter for empty lines in other buffer
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(n (1- (count-lines (point-min) (point))))
|
|
|
|
|
chars other)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(backward-char arg)
|
|
|
|
|
(setq chars (buffer-substring (point) point))
|
|
|
|
|
(skip-chars-forward " \t" point)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(make-local-variable '2C-separator)
|
|
|
|
|
(setq 2C-separator (buffer-substring (point) point)
|
2009-06-04 01:11:06 +00:00
|
|
|
|
2C-window-width (+ (fringe-columns 'left)
|
|
|
|
|
(fringe-columns 'right)
|
|
|
|
|
(scroll-bar-columns 'left)
|
|
|
|
|
(scroll-bar-columns 'right)
|
|
|
|
|
(current-column))))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(2C-two-columns)
|
|
|
|
|
(setq other (2C-other))
|
2009-06-04 01:11:06 +00:00
|
|
|
|
;; now we're ready to actually split
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(while (not (eobp))
|
2009-06-04 01:11:06 +00:00
|
|
|
|
(if (not (and (= (current-column) column)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(string= chars
|
|
|
|
|
(buffer-substring (point)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(backward-char arg)
|
|
|
|
|
(point))))))
|
|
|
|
|
(setq n (1+ n))
|
|
|
|
|
(setq point (point))
|
|
|
|
|
(backward-char arg)
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(delete-region point (point))
|
|
|
|
|
(setq point (point))
|
|
|
|
|
(insert-char ?\n n)
|
|
|
|
|
(append-to-buffer other point (progn (end-of-line)
|
|
|
|
|
(if (eobp)
|
|
|
|
|
(point)
|
|
|
|
|
(1+ (point)))))
|
|
|
|
|
(delete-region point (point))
|
|
|
|
|
(setq n 0))
|
2009-06-04 01:11:06 +00:00
|
|
|
|
(forward-line 1)
|
|
|
|
|
(move-to-column column)))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
|
|
|
|
(defun 2C-dissociate ()
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Turn off two-column minor mode in current and associated buffer.
|
|
|
|
|
If the associated buffer is unmodified and empty, it is killed."
|
|
|
|
|
(interactive)
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(let ((buffer (current-buffer))
|
|
|
|
|
(other (2C-other)))
|
|
|
|
|
(if other
|
|
|
|
|
(with-current-buffer other
|
|
|
|
|
(when (or (not (2C-other)) (eq buffer (2C-other)))
|
|
|
|
|
(if (and (not (buffer-modified-p)) (zerop (buffer-size)))
|
|
|
|
|
(kill-buffer)
|
|
|
|
|
(kill-local-variable '2C-mode)
|
|
|
|
|
(kill-local-variable '2C-window-width)
|
|
|
|
|
(kill-local-variable '2C-separator)
|
|
|
|
|
(kill-local-variable 'mode-line-format)
|
|
|
|
|
(kill-local-variable 'fill-column))))))
|
|
|
|
|
(kill-local-variable '2C-mode)
|
|
|
|
|
(kill-local-variable '2C-window-width)
|
|
|
|
|
(kill-local-variable '2C-separator)
|
|
|
|
|
(kill-local-variable 'mode-line-format)
|
|
|
|
|
(kill-local-variable 'fill-column)
|
|
|
|
|
(force-mode-line-update))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; this doesn't use yank-rectangle, so that the first column can
|
|
|
|
|
;; contain long lines
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defun 2C-merge ()
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Merges the associated buffer with the current buffer.
|
1995-07-07 20:01:01 +00:00
|
|
|
|
They get merged at the column, which is the value of `2C-window-width',
|
|
|
|
|
i.e. usually at the vertical window separator. This separator gets
|
|
|
|
|
replaced with white space. Beyond that the value of `2C-separator' gets
|
|
|
|
|
inserted on merged lines. The two columns are thus pasted side by side,
|
|
|
|
|
in a single text. If the other buffer is not displayed to the left of
|
|
|
|
|
this one, then this one becomes the left column.
|
|
|
|
|
|
|
|
|
|
If you want `2C-separator' on empty lines in the second column,
|
1992-07-17 06:48:03 +00:00
|
|
|
|
you should put just one space in them. In the final result, you can strip
|
2000-11-22 20:59:39 +00:00
|
|
|
|
off trailing spaces with \\[delete-trailing-whitespace]."
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(and (> (car (window-edges)) 0) ; not touching left edge of screen
|
|
|
|
|
(eq (window-buffer (previous-window))
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(2C-other t))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(other-window -1))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((b1 (current-buffer))
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(b2 (2C-other t))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
string)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(set-buffer b2)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(setq string (buffer-substring (point)
|
|
|
|
|
(progn (end-of-line) (point))))
|
|
|
|
|
(or (eobp)
|
|
|
|
|
(forward-char)) ; next line
|
|
|
|
|
(set-buffer b1)
|
|
|
|
|
(if (string= string "")
|
|
|
|
|
()
|
|
|
|
|
(end-of-line)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(indent-to-column 2C-window-width)
|
|
|
|
|
(insert 2C-separator string))
|
2007-10-19 18:41:09 +00:00
|
|
|
|
(forward-line 1) ; add one if necessary
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(set-buffer b2))))
|
2007-08-08 06:04:51 +00:00
|
|
|
|
(unless (window-full-width-p)
|
|
|
|
|
(enlarge-window 99999 t)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;;;; utility functions ;;;;;
|
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defun 2C-associated-buffer ()
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Switch to associated buffer."
|
|
|
|
|
(interactive)
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(let ((line (+ (count-lines (point-min) (point))
|
|
|
|
|
(if (bolp) 1 0)))
|
|
|
|
|
(col (if (eolp) (if (bolp) 0) (current-column))))
|
|
|
|
|
(if (get-buffer-window (2C-other t))
|
|
|
|
|
(select-window (get-buffer-window (2C-other)))
|
|
|
|
|
(switch-to-buffer (2C-other)))
|
2009-08-22 19:29:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(newline (forward-line (1- line)))
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(if col
|
|
|
|
|
(move-to-column col)
|
|
|
|
|
(end-of-line 1))))
|
|
|
|
|
|
|
|
|
|
(defun 2C-newline (arg)
|
|
|
|
|
"Insert ARG newlines in both buffers."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(2C-associated-buffer)
|
|
|
|
|
(newline arg))
|
|
|
|
|
(newline arg))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(defun 2C-toggle-autoscroll (arg)
|
2007-08-08 07:27:21 +00:00
|
|
|
|
"Toggle autoscrolling.
|
|
|
|
|
With prefix argument ARG, turn on autoscrolling if ARG is
|
|
|
|
|
positive, otherwise turn it off. When autoscrolling is turned
|
|
|
|
|
on, this also realigns the two buffers."
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(interactive "P")
|
1995-08-01 22:42:28 +00:00
|
|
|
|
;(sit-for 0)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(setq 2C-autoscroll-start (window-start))
|
|
|
|
|
(if (setq 2C-autoscroll (if arg
|
|
|
|
|
(>= (prefix-numeric-value arg) 0)
|
|
|
|
|
(not 2C-autoscroll)))
|
|
|
|
|
(select-window
|
|
|
|
|
(prog1 (selected-window)
|
|
|
|
|
(message "Autoscrolling is on.")
|
|
|
|
|
(setq arg (count-lines (point-min) (window-start)))
|
1995-08-01 22:42:28 +00:00
|
|
|
|
(if (get-buffer-window (2C-other t))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(progn
|
|
|
|
|
(select-window (get-buffer-window (2C-other)))
|
|
|
|
|
(setq arg (- arg (count-lines (point-min) (window-start))))
|
|
|
|
|
;; make sure that other buffer has enough lines
|
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-char ?\n
|
|
|
|
|
(- arg (count-lines (window-start)
|
|
|
|
|
(goto-char (point-max)))
|
|
|
|
|
-1)))
|
|
|
|
|
(scroll-up arg)))))
|
|
|
|
|
(message "Autoscrolling is off.")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun 2C-autoscroll ()
|
|
|
|
|
(if 2C-autoscroll
|
|
|
|
|
;; catch a mouse scroll on non-selected scrollbar
|
|
|
|
|
(select-window
|
|
|
|
|
(prog1 (selected-window)
|
2009-01-09 04:23:38 +00:00
|
|
|
|
(and (consp last-command-event)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(not (eq (selected-window)
|
2009-01-09 04:23:38 +00:00
|
|
|
|
(car (car (cdr last-command-event)))))
|
|
|
|
|
(select-window (car (car (cdr last-command-event)))))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
;; In some cases scrolling causes an error, but post-command-hook
|
|
|
|
|
;; shouldn't, and should always stay in the original window
|
2012-04-16 16:13:38 -04:00
|
|
|
|
(ignore-errors
|
|
|
|
|
(and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil)
|
|
|
|
|
(/= (window-start) 2C-autoscroll-start)
|
|
|
|
|
(2C-other)
|
|
|
|
|
(get-buffer-window (2C-other))
|
|
|
|
|
(let ((lines (count-lines (window-start)
|
|
|
|
|
2C-autoscroll-start)))
|
|
|
|
|
(if (< (window-start) 2C-autoscroll-start)
|
|
|
|
|
(setq lines (- lines)))
|
|
|
|
|
(setq 2C-autoscroll-start (window-start))
|
|
|
|
|
(select-window (get-buffer-window (2C-other)))
|
|
|
|
|
;; make sure that other buffer has enough lines
|
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-char
|
|
|
|
|
?\n (- lines (count-lines (window-start)
|
|
|
|
|
(goto-char (point-max)))
|
|
|
|
|
-1)))
|
|
|
|
|
(scroll-up lines)
|
|
|
|
|
(setq 2C-autoscroll-start (window-start)))))))))
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-11-03 03:11:24 +00:00
|
|
|
|
(defun 2C-enlarge-window-horizontally (arg)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Make current window ARG columns wider."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(enlarge-window arg t)
|
1995-07-07 20:01:01 +00:00
|
|
|
|
(and (2C-other)
|
|
|
|
|
(setq 2C-window-width (+ 2C-window-width arg))
|
|
|
|
|
(set-buffer (2C-other))
|
|
|
|
|
(setq 2C-window-width (- 2C-window-width arg))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-11-03 03:11:24 +00:00
|
|
|
|
(defun 2C-shrink-window-horizontally (arg)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
"Make current window ARG columns narrower."
|
|
|
|
|
(interactive "p")
|
1995-11-03 03:11:24 +00:00
|
|
|
|
(2C-enlarge-window-horizontally (- arg)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1995-07-07 20:01:01 +00:00
|
|
|
|
|
1992-09-28 13:02:35 +00:00
|
|
|
|
(provide 'two-column)
|
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;;; two-column.el ends here
|