Mercurial > emacs
annotate lisp/textmodes/two-column.el @ 97774:cf6404e22e31
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 27 Aug 2008 20:21:31 +0000 |
parents | cc5c17b126b3 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
809 | 1 ;;; two-column.el --- minor mode for editing of two-column text |
2 | |
74509 | 3 ;; Copyright (C) 1992, 1993, 1994, 1995, 2001, 2002, 2003, 2004, |
79719 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
809 | 5 |
23869 | 6 ;; Author: Daniel Pfeiffer <occitan@esperanto.org> |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
7 ;; Adapted-By: ESR, Daniel Pfeiffer |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
38436
diff
changeset
|
8 ;; Keywords: wp |
809 | 9 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33786
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33786
diff
changeset
|
11 |
94669
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
809 | 16 |
94669
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
20 ;; GNU General Public License for more details. |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
21 |
94669
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
cc5c17b126b3
Remove translation of permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
24 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33786
diff
changeset
|
25 ;;; Commentary: |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
26 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
27 ;;; Komentario: Commentary: |
809 | 28 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
29 ;; Tiu programaro ebligas vin redakti This package gives you the ability |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
30 ;; dukolumnan tekston. to edit text in a two-column format. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
31 |
809 | 32 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
33 ;; Vi havas tri eblecojn por eki tiun You have three ways to start up this |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
34 ;; mal^cefan modalon. ^Ciu donas al vi minor mode. Each gives you a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
35 ;; horizontale disigatan fenestron, si- horizontally split window similar to |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
36 ;; milan al fina apareco de via teksto: the final outcome of your text: |
809 | 37 |
38 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
39 ;; f2 2 asocias novan bufron nomatan associates a new buffer called |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
40 ;; C-x 6 2 same, sed kun 2C/ anta^u. the same, but with 2C/ |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
41 ;; prepended. |
809 | 42 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
43 ;; f2 b asocias alian bufron. Vi povas associates another buffer. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
44 ;; C-x 6 b anka^u asocii dataron, se vi This can be used to associate a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
45 ;; ^jus anta^ue faris C-x C-f. file if you just did C-x C-f. |
809 | 46 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
47 ;; f2 s disigas jam dukolumnan tekston splits a two-column text into |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
48 ;; C-x 6 s en du bufroj ekde la nuna two buffers from the current |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
49 ;; linio, kaj je la nuna kolumno. line and at the current column. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
50 ;; La anta^uaj signoj (ofte The preceding characters (often |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
51 ;; tabeligilo a^u |) estas la tab or |) are the column |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
52 ;; kolumna disiganto. Linioj kiuj separator. Lines that don't |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
53 ;; ne enhavas ilin ne estas have them won't be separated. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
54 ;; disigitaj. Kiel la kvara kaj Like the fourth and fifth line |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
55 ;; la kvina linio se vi disigas if you split this file from |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
56 ;; ^ci dataron ekde la unua angla the first english word. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
57 ;; vorto. |
809 | 58 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
59 ;; Se vi volas meti longajn liniojn If you include long lines, i.e which |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
60 ;; (ekz. programerojn) en la kunigotan will span both columns (eg. source |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
61 ;; tekston, ili devas esti en la code), they should be in what will |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
62 ;; estonte unua kolumno. La alia devas be the first column, with the |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
63 ;; havi vakajn linion apud ili. associated buffer having empty lines |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
64 ;; next to them. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
65 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
66 ;; Averto: en Emacs kiam vi ^san^gas la Attention: in Emacs when you change |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
67 ;; ^cefan modalon, la mal^cefaj modaloj the major mode, the minor modes are |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
68 ;; estas anka^u elmemorigitaj. Tiu- also purged from memory. In that |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
69 ;; okaze vi devas religi la du bufrojn case you must reassociate the two |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
70 ;; per iu C-x 6-ordono, ekz. C-x 6 b. buffers with any C-x 6-command, e.g. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
71 ;; C-x 6 b. |
809 | 72 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
73 ;; Kiam vi estos kontenta de la When you have edited both buffers to |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
74 ;; rezulto, vi kunmetos la du kolumnojn your content, you merge them with |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
75 ;; per C-x 6 1. Se vi poste vidas C-x 6 1. If you then see a problem, |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
76 ;; problemon, vi neniigu la kunmeton you undo the merge with C-x u and |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
77 ;; per C-x u kaj plue modifu la du continue to edit the two buffers. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
78 ;; bufrojn. Kiam vi ne plu volas tajpi When you no longer want to edit in |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
79 ;; dukolumne, vi eliru el la mal^cefa two columns, you turn off the minor |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
80 ;; modalo per C-x 6 d. mode with C-x 6 d. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
81 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
82 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
83 ;; Aldone al dukolumna redaktado, ek- In addition to two-column editing of |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
84 ;; zemple por skribi dulingvan tekston text, for example for writing a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
85 ;; flank-al-flanke kiel ^ci tiu, aliaj bilingual text side-by-side as shown |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
86 ;; interesaj uzoj trovitas por tiu mal- here, other interesting uses have |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
87 ;; ^cefa modalo: been found for this minor mode: |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
88 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
89 ;; Vi povas disigi la kolumnojn per {+} You can separate the columns with |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
90 ;; ajna pla^ca ^ceno starigante {+} any string that pleases you, by |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
91 ;; `2C-separator'. Ekzemple "{+} " {+} setting `2C-separator'. For example |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
92 ;; por amuzi^gi. f2 s a^u C-x 6 s {+} "{+} " if you'd like to have fun. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
93 ;; traktas tiujn kun prefiksa {+} f2 s or C-x 6 s handles these with a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
94 ;; argumento kiu signifas la longon {+} prefix argument that means the |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
95 ;; de tia ^ceno. {+} desired length of such a string. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
96 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
97 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
98 ;; Programistoj eble ^satus la eblecon Programmers might like the ability |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
99 ;; forspliti la komentarian kolumnon de to split off the comment column of a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
100 ;; dosiero kiel la sekvanta. Vi povas file that looks like the following. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
101 ;; rearan^gigi la paragrafon. La pro- You can fill-paragraph the comment. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
102 ;; blemo estas ke koda^jo tuj lar- The problem is, code quickly gets |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
103 ;; ^gi^gas, tiel ke vi bezonas pli rather wide, so you need to use a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
104 ;; mallar^gan komentarian kolumnon. narrower comment column. Code lines |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
105 ;; Koda^jaj linioj tra `comment-column' that reach beyond `comment-column' |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
106 ;; ne problemas, krom ke vi ne vidos are no problem, except that you |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
107 ;; iliajn finojn dum redaktado. won't see their end during editing. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
108 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
109 |
809 | 110 ;; BEGIN -- This is just some meaningless |
111 ;; FOR i IN 1..10 LOOP -- code in Ada, that runs foobar | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
112 ;; foobar( i ); -- once for each argument from one |
809 | 113 ;; END LOOP; -- to ten, and then we're already |
114 ;; END; -- through with it. | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
115 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
116 ;; Pli bone ankora^u, vi povas pozici- Better yet, you can put the point |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
117 ;; i^gi anta^u "This", tajpi M-3 f2 s before "This", type M-3 f2 s |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
118 ;; kiu igas "-- " la separigilon inter which makes "-- " the separator |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
119 ;; senkomentaria Ada bufro kaj nur- between a no-comments Ada buffer, |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
120 ;; teksta komentaria bufro. Kiam vi and a plain text comment buffer. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
121 ;; denove kuni^gos ilin, ^ciu nevaka When you put them back together, |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
122 ;; linio de l' dua kolumno denove every non-empty line of the 2nd |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
123 ;; anta^uhavos "-- ". column will again be preceded by |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
124 ;; "-- ". |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
125 |
809 | 126 |
127 ;;; Code: | |
128 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
129 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
130 ;; Lucid patch |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
131 (or (fboundp 'frame-width) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
132 (fset 'frame-width 'screen-width)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
133 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
134 |
1245
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
135 ;;;;; Set up keymap ;;;;; |
809 | 136 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
137 (defvar 2C-mode-map |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
138 (let ((map (make-sparse-keymap))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
139 (define-key map "2" '2C-two-columns) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
140 (define-key map [f2] '2C-two-columns) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
141 (define-key map "b" '2C-associate-buffer) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
142 (define-key map "s" '2C-split) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
143 map) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
144 "Keymap for commands for setting up two-column mode.") |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
145 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
146 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
147 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
148 ;;;###autoload (autoload '2C-command "two-column" () t 'keymap) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
149 (fset '2C-command 2C-mode-map) |
809 | 150 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
151 ;; This one is for historical reasons and simple keyboards, it is not |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
152 ;; at all mnemonic. All usual sequences containing 2 were used, and |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
153 ;; f2 could not be set up in a standard way under Emacs 18. |
22303 | 154 ;;;###autoload (global-set-key "\C-x6" '2C-command) |
809 | 155 |
22303 | 156 ;;;###autoload (global-set-key [f2] '2C-command) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
157 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
158 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
159 (defvar 2C-minor-mode-map |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
160 (let ((map (make-sparse-keymap))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
161 (define-key map "1" '2C-merge) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
162 (define-key map "d" '2C-dissociate) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
163 (define-key map "o" '2C-associated-buffer) |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
164 (define-key map "\^m" '2C-newline) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
165 (define-key map "|" '2C-toggle-autoscroll) |
13388
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
166 (define-key map "{" '2C-shrink-window-horizontally) |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
167 (define-key map "}" '2C-enlarge-window-horizontally) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
168 map) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
169 "Keymap for commands for use in two-column mode.") |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
170 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
171 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
172 (setq minor-mode-map-alist |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
173 (cons (cons '2C-mode |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
174 (let ((map (make-sparse-keymap))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
175 (substitute-key-definition '2C-command 2C-minor-mode-map |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
176 map (current-global-map)) |
13388
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
177 (substitute-key-definition 'enlarge-window-horizontally |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
178 '2C-enlarge-window-horizontally |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
179 map (current-global-map)) |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
180 (substitute-key-definition 'shrink-window-horizontally |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
181 '2C-shrink-window-horizontally |
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
182 map (current-global-map)) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
183 map)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
184 minor-mode-map-alist)) |
1245
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
185 |
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
186 ;;;;; variable declarations ;;;;; |
809 | 187 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
188 (defgroup two-column nil |
64062
50af47b41b9c
(two-column): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
189 "Minor mode for editing of two-column text." |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
190 :prefix "2C-" |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
191 :group 'frames) |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
192 |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
193 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
194 ;; Markers seem to be the only buffer-id not affected by renaming a buffer. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
195 ;; This nevertheless loses when a buffer is killed. The variable-name is |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
196 ;; required by `describe-mode'. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
197 (defvar 2C-mode nil |
809 | 198 "Marker to the associated buffer, if non-nil.") |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
199 (make-variable-buffer-local '2C-mode) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
200 (put '2C-mode 'permanent-local t) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
201 |
809 | 202 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
203 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
204 (setq minor-mode-alist (cons '(2C-mode " 2C") minor-mode-alist)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
205 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
206 |
809 | 207 |
208 ;; rearranged, so that the pertinent info will show in 40 columns | |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
209 (defcustom 2C-mode-line-format |
809 | 210 '("-%*- %15b --" (-3 . "%p") "--%[(" mode-name |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
211 minor-mode-alist "%n" mode-line-process ")%]%-") |
51963
27b622ce6604
(2C-mode-line-format): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
39892
diff
changeset
|
212 "*Value of `mode-line-format' for a buffer in two-column minor mode." |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
213 :type 'sexp |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
214 :group 'two-column) |
809 | 215 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
216 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
217 (defcustom 2C-other-buffer-hook 'text-mode |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
218 "*Hook run in new buffer when it is associated with current one." |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
219 :type 'function |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
220 :group 'two-column) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
221 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
222 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
223 (defcustom 2C-separator "" |
809 | 224 "*A string inserted between the two columns when merging. |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
225 This gets set locally by \\[2C-split]." |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
226 :type 'string |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
227 :group 'two-column) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
228 (put '2C-separator 'permanent-local t) |
809 | 229 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
230 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
231 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
232 (defcustom 2C-window-width 40 |
809 | 233 "*The width of the first column. (Must be at least `window-min-width') |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
234 This value is local for every buffer that sets it." |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
235 :type 'integer |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
236 :group 'two-column) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
237 (make-variable-buffer-local '2C-window-width) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
238 (put '2C-window-width 'permanent-local t) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
239 |
809 | 240 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
241 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
242 (defcustom 2C-beyond-fill-column 4 |
809 | 243 "*Base for calculating `fill-column' for a buffer in two-column minor mode. |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
244 The value of `fill-column' becomes `2C-window-width' for this buffer |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
245 minus this value." |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
246 :type 'integer |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
247 :group 'two-column) |
809 | 248 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
249 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
250 |
17430
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
251 (defcustom 2C-autoscroll t |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
252 "If non-nil, Emacs attempts to keep the two column's buffers aligned." |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
253 :type 'boolean |
de68258fef5f
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16421
diff
changeset
|
254 :group 'two-column) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
255 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
256 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
257 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
258 (defvar 2C-autoscroll-start nil) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
259 (make-variable-buffer-local '2C-autoscroll-start) |
809 | 260 |
261 ;;;;; base functions ;;;;; | |
262 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
263 ;; The access method for the other buffer. This tries to remedy against |
809 | 264 ;; lost local variables and lost buffers. |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
265 (defun 2C-other (&optional req) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
266 (or (if 2C-mode |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
267 (or (prog1 |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
268 (marker-buffer 2C-mode) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
269 (setq mode-line-format 2C-mode-line-format)) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
270 ;; The associated buffer somehow got killed. |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
271 (progn |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
272 ;; The other variables may later be useful if the user |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
273 ;; reestablishes the association. |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
274 (kill-local-variable '2C-mode) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
275 (kill-local-variable 'mode-line-format) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
276 nil))) |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33786
diff
changeset
|
277 (if req (error "You must first set two-column minor mode")))) |
809 | 278 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
279 |
809 | 280 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
281 ;; function for setting up two-column minor mode in a buffer associated |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
282 ;; with the buffer pointed to by the marker other. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
283 (defun 2C-mode (other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
284 "Minor mode for independently editing two columns. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
285 This is set up for two associated buffers by the three commands bound |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
286 to \\[2C-two-columns] , \\[2C-associate-buffer] and \\[2C-split]. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
287 Turning on two-column mode calls the value of the variable `2C-mode-hook', |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
288 if that value is non-nil. |
809 | 289 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
290 These buffers can be edited separately, for example with `fill-paragraph'. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
291 If you want to disable parallel scrolling temporarily, use \\[2C-toggle-autoscroll] . |
809 | 292 |
293 If you include long lines, i.e which will span both columns (eg. | |
294 source code), they should be in what will be the first column, with | |
295 the associated buffer having empty lines next to them. | |
296 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
297 Potential uses are writing bilingual texts, or editing the comments of a |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
298 source code. See the file lisp/two-column.el for detailed examples. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
299 |
809 | 300 You have the following commands at your disposal: |
301 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
302 \\[2C-two-columns] Rearrange screen with current buffer first |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
303 \\[2C-associate-buffer] Reassociate buffer after changing major mode |
809 | 304 \\[shrink-window-horizontally], \\[enlarge-window-horizontally] Shrink, enlarge current column |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
305 \\[2C-associated-buffer] Switch to associated buffer at same point |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
306 \\[2C-newline] Insert newline(s) in both buffers at same point |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
307 \\[2C-merge] Merge both buffers |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
308 \\[2C-dissociate] Dissociate the two buffers |
809 | 309 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
310 These keybindings can be customized in your ~/.emacs by `2C-mode-map', |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
311 `2C-minor-mode-map' and by binding `2C-command' to some prefix. |
809 | 312 |
313 The appearance of the screen can be customized by the variables | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
314 `2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
315 `truncate-partial-width-windows'." |
12934
7fd541abf2af
(2C-mode): Use make-local-hook and add-hook.
Richard M. Stallman <rms@gnu.org>
parents:
12739
diff
changeset
|
316 (add-hook 'post-command-hook '2C-autoscroll nil t) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
317 (setq fill-column (- 2C-window-width |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
318 2C-beyond-fill-column) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
319 mode-line-format 2C-mode-line-format |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
320 2C-mode other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
321 (run-hooks '2C-mode-hook)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
322 |
809 | 323 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
324 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
325 ;;;###autoload |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
326 (defun 2C-two-columns (&optional buffer) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
327 "Split current window vertically for two-column editing. |
73301
3fc5212fe32a
(2C-two-columns): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
328 \\<global-map>When called the first time, associates a buffer with the current |
73307
719af03ef247
(2C-two-columns): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
73301
diff
changeset
|
329 buffer in two-column minor mode (use \\[describe-mode] once in the mode, |
719af03ef247
(2C-two-columns): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
73301
diff
changeset
|
330 for details.). It runs `2C-other-buffer-hook' in the new buffer. |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
331 When called again, restores the screen layout with the current buffer |
16421
65d4b4b2e954
(2C-two-columns): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13388
diff
changeset
|
332 first and the associated buffer to its right." |
809 | 333 (interactive "P") |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
334 ;; first go to full width, so that we can certainly split into two windows |
78466
99b67eaf3990
(2C-two-columns, 2C-merge): Use window-full-width-p instead of comparing
Martin Rudalics <rudalics@gmx.at>
parents:
78225
diff
changeset
|
335 (unless (window-full-width-p) |
99b67eaf3990
(2C-two-columns, 2C-merge): Use window-full-width-p instead of comparing
Martin Rudalics <rudalics@gmx.at>
parents:
78225
diff
changeset
|
336 (enlarge-window 99999 t)) |
809 | 337 (split-window-horizontally |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
338 (max window-min-width (min 2C-window-width |
1245
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
339 (- (frame-width) window-min-width)))) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
340 (if (2C-other) |
809 | 341 (progn |
342 (other-window 1) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
343 (switch-to-buffer (2C-other)) |
809 | 344 (other-window -1) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
345 (if 2C-autoscroll |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
346 (2C-toggle-autoscroll t))) |
809 | 347 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
348 (2C-mode (prog1 (point-marker) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
349 (other-window 1) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
350 (switch-to-buffer |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
351 (or buffer |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
352 (generate-new-buffer (concat "2C/" (buffer-name))))) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
353 (or buffer |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
354 (run-hooks '2C-other-buffer-hook)))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
23869
diff
changeset
|
355 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
356 (2C-mode (prog1 (point-marker) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
357 (other-window -1))))) |
809 | 358 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
359 |
809 | 360 |
1904
cca15d76f3e5
* two-column.el: Add autoloads for the functions defined in
Jim Blandy <jimb@redhat.com>
parents:
1245
diff
changeset
|
361 ;;;###autoload |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
362 (defun 2C-associate-buffer () |
809 | 363 "Associate another buffer with this one in two-column minor mode. |
364 Can also be used to associate a just previously visited file, by | |
365 accepting the proposed default buffer. | |
366 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
367 \(See \\[describe-mode] .)" |
809 | 368 (interactive) |
369 (let ((b1 (current-buffer)) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
370 (b2 (or (2C-other) |
809 | 371 (read-buffer "Associate buffer: " (other-buffer))))) |
372 (save-excursion | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
373 (setq 2C-mode nil) |
809 | 374 (set-buffer b2) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
375 (and (2C-other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
376 (not (eq b1 (2C-other))) |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
33786
diff
changeset
|
377 (error "Buffer already associated with buffer `%s'" |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
378 (buffer-name (2C-other)))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
379 (setq b1 (and (assq '2C-window-width (buffer-local-variables)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
380 2C-window-width))) |
809 | 381 ; if other buffer has a local width, adjust here too |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
382 (if b1 (setq 2C-window-width (- (frame-width) b1))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
383 (2C-two-columns b2))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
384 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
385 |
809 | 386 |
1904
cca15d76f3e5
* two-column.el: Add autoloads for the functions defined in
Jim Blandy <jimb@redhat.com>
parents:
1245
diff
changeset
|
387 ;;;###autoload |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
388 (defun 2C-split (arg) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
389 "Split a two-column text at point, into two buffers in two-column minor mode. |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
390 Point becomes the local value of `2C-window-width'. Only lines that |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
391 have the ARG same preceding characters at that column get split. The |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
392 ARG preceding characters without any leading whitespace become the local |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
393 value for `2C-separator'. This way lines that continue across both |
809 | 394 columns remain untouched in the first buffer. |
395 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
396 This function can be used with a prototype line, to set up things. You |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
397 write the first line of each column and then split that line. E.g.: |
809 | 398 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
399 First column's text sSs Second column's text |
809 | 400 \\___/\\ |
401 / \\ | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
402 5 character Separator You type M-5 \\[2C-split] with the point here. |
809 | 403 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
404 \(See \\[describe-mode] .)" |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
405 (interactive "*p") |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
406 (and (2C-other) |
809 | 407 (if (y-or-n-p (concat "Overwrite associated buffer `" |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
408 (buffer-name (2C-other)) |
809 | 409 "'? ")) |
410 (save-excursion | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
411 (set-buffer (2C-other)) |
809 | 412 (erase-buffer)) |
413 (signal 'quit nil))) | |
414 (let ((point (point)) | |
415 ; make next-line always come back to same column | |
416 (goal-column (current-column)) | |
417 ; a counter for empty lines in other buffer | |
418 (n (1- (count-lines (point-min) (point)))) | |
419 chars other) | |
420 (save-excursion | |
421 (backward-char arg) | |
422 (setq chars (buffer-substring (point) point)) | |
423 (skip-chars-forward " \t" point) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
424 (make-local-variable '2C-separator) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
425 (setq 2C-separator (buffer-substring (point) point) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
426 2C-window-width (current-column))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
427 (2C-two-columns) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
428 (setq other (2C-other)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
429 ; now we're ready to actually split |
809 | 430 (save-excursion |
431 (while (not (eobp)) | |
432 (if (not (and (= (current-column) goal-column) | |
433 (string= chars | |
434 (buffer-substring (point) | |
435 (save-excursion | |
436 (backward-char arg) | |
437 (point)))))) | |
438 (setq n (1+ n)) | |
439 (setq point (point)) | |
440 (backward-char arg) | |
441 (skip-chars-backward " \t") | |
442 (delete-region point (point)) | |
443 (setq point (point)) | |
444 (insert-char ?\n n) | |
445 (append-to-buffer other point (progn (end-of-line) | |
446 (if (eobp) | |
447 (point) | |
448 (1+ (point))))) | |
449 (delete-region point (point)) | |
450 (setq n 0)) | |
85451
e1af3a725ca4
* textmodes/two-column.el (2C-split, 2C-merge):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78482
diff
changeset
|
451 (forward-line 1))))) |
809 | 452 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
453 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
454 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
455 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
456 (defun 2C-dissociate () |
809 | 457 "Turn off two-column minor mode in current and associated buffer. |
458 If the associated buffer is unmodified and empty, it is killed." | |
459 (interactive) | |
460 (let ((buffer (current-buffer))) | |
461 (save-excursion | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
462 (and (2C-other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
463 (set-buffer (2C-other)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
464 (or (not (2C-other)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
465 (eq buffer (2C-other))) |
809 | 466 (if (and (not (buffer-modified-p)) |
467 (eobp) (bobp)) | |
468 (kill-buffer nil) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
469 (kill-local-variable '2C-mode) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
470 (kill-local-variable '2C-window-width) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
471 (kill-local-variable '2C-separator) |
809 | 472 (kill-local-variable 'mode-line-format) |
473 (kill-local-variable 'fill-column)))) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
474 (kill-local-variable '2C-mode) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
475 (kill-local-variable '2C-window-width) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
476 (kill-local-variable '2C-separator) |
809 | 477 (kill-local-variable 'mode-line-format) |
478 (kill-local-variable 'fill-column))) | |
479 | |
480 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
481 |
809 | 482 ;; this doesn't use yank-rectangle, so that the first column can |
483 ;; contain long lines | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
484 (defun 2C-merge () |
809 | 485 "Merges the associated buffer with the current buffer. |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
486 They get merged at the column, which is the value of `2C-window-width', |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
487 i.e. usually at the vertical window separator. This separator gets |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
488 replaced with white space. Beyond that the value of `2C-separator' gets |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
489 inserted on merged lines. The two columns are thus pasted side by side, |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
490 in a single text. If the other buffer is not displayed to the left of |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
491 this one, then this one becomes the left column. |
809 | 492 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
493 If you want `2C-separator' on empty lines in the second column, |
809 | 494 you should put just one space in them. In the final result, you can strip |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
23869
diff
changeset
|
495 off trailing spaces with \\[delete-trailing-whitespace]." |
809 | 496 (interactive) |
497 (and (> (car (window-edges)) 0) ; not touching left edge of screen | |
498 (eq (window-buffer (previous-window)) | |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
499 (2C-other t)) |
809 | 500 (other-window -1)) |
501 (save-excursion | |
502 (let ((b1 (current-buffer)) | |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
503 (b2 (2C-other t)) |
809 | 504 string) |
505 (goto-char (point-min)) | |
506 (set-buffer b2) | |
507 (goto-char (point-min)) | |
508 (while (not (eobp)) | |
509 (setq string (buffer-substring (point) | |
510 (progn (end-of-line) (point)))) | |
511 (or (eobp) | |
512 (forward-char)) ; next line | |
513 (set-buffer b1) | |
514 (if (string= string "") | |
515 () | |
516 (end-of-line) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
517 (indent-to-column 2C-window-width) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
518 (insert 2C-separator string)) |
85451
e1af3a725ca4
* textmodes/two-column.el (2C-split, 2C-merge):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78482
diff
changeset
|
519 (forward-line 1) ; add one if necessary |
809 | 520 (set-buffer b2)))) |
78466
99b67eaf3990
(2C-two-columns, 2C-merge): Use window-full-width-p instead of comparing
Martin Rudalics <rudalics@gmx.at>
parents:
78225
diff
changeset
|
521 (unless (window-full-width-p) |
99b67eaf3990
(2C-two-columns, 2C-merge): Use window-full-width-p instead of comparing
Martin Rudalics <rudalics@gmx.at>
parents:
78225
diff
changeset
|
522 (enlarge-window 99999 t))) |
809 | 523 |
524 ;;;;; utility functions ;;;;; | |
525 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
526 (defun 2C-associated-buffer () |
809 | 527 "Switch to associated buffer." |
528 (interactive) | |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
529 (let ((line (+ (count-lines (point-min) (point)) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
530 (if (bolp) 1 0))) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
531 (col (if (eolp) (if (bolp) 0) (current-column)))) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
532 (if (get-buffer-window (2C-other t)) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
533 (select-window (get-buffer-window (2C-other))) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
534 (switch-to-buffer (2C-other))) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
535 (newline (goto-line line)) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
536 (if col |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
537 (move-to-column col) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
538 (end-of-line 1)))) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
539 |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
540 (defun 2C-newline (arg) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
541 "Insert ARG newlines in both buffers." |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
542 (interactive "P") |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
543 (save-window-excursion |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
544 (2C-associated-buffer) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
545 (newline arg)) |
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
546 (newline arg)) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
547 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
548 (defun 2C-toggle-autoscroll (arg) |
78482
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78466
diff
changeset
|
549 "Toggle autoscrolling. |
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78466
diff
changeset
|
550 With prefix argument ARG, turn on autoscrolling if ARG is |
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78466
diff
changeset
|
551 positive, otherwise turn it off. When autoscrolling is turned |
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78466
diff
changeset
|
552 on, this also realigns the two buffers." |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
553 (interactive "P") |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
554 ;(sit-for 0) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
555 (setq 2C-autoscroll-start (window-start)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
556 (if (setq 2C-autoscroll (if arg |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
557 (>= (prefix-numeric-value arg) 0) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
558 (not 2C-autoscroll))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
559 (select-window |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
560 (prog1 (selected-window) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
561 (message "Autoscrolling is on.") |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
562 (setq arg (count-lines (point-min) (window-start))) |
12739
ae2e8daffa31
(2C-toggle-autoscroll, 2C-autoscroll):
Karl Heuer <kwzh@gnu.org>
parents:
12506
diff
changeset
|
563 (if (get-buffer-window (2C-other t)) |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
564 (progn |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
565 (select-window (get-buffer-window (2C-other))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
566 (setq arg (- arg (count-lines (point-min) (window-start)))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
567 ;; make sure that other buffer has enough lines |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
568 (save-excursion |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
569 (insert-char ?\n |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
570 (- arg (count-lines (window-start) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
571 (goto-char (point-max))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
572 -1))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
573 (scroll-up arg))))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
574 (message "Autoscrolling is off."))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
575 |
809 | 576 |
577 | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
578 (defun 2C-autoscroll () |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
579 (if 2C-autoscroll |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
580 ;; catch a mouse scroll on non-selected scrollbar |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
581 (select-window |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
582 (prog1 (selected-window) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
583 (and (consp last-command-char) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
584 (not (eq (selected-window) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
585 (car (car (cdr last-command-char))))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
586 (select-window (car (car (cdr last-command-char))))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
587 ;; In some cases scrolling causes an error, but post-command-hook |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
588 ;; shouldn't, and should always stay in the original window |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
589 (condition-case () |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
590 (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
591 (/= (window-start) 2C-autoscroll-start) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
592 (2C-other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
593 (get-buffer-window (2C-other)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
594 (let ((lines (count-lines (window-start) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
595 2C-autoscroll-start))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
596 (if (< (window-start) 2C-autoscroll-start) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
597 (setq lines (- lines))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
598 (setq 2C-autoscroll-start (window-start)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
599 (select-window (get-buffer-window (2C-other))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
600 ;; make sure that other buffer has enough lines |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
601 (save-excursion |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
602 (insert-char |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
603 ?\n (- lines (count-lines (window-start) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
604 (goto-char (point-max))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
605 -1))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
606 (scroll-up lines) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
607 (setq 2C-autoscroll-start (window-start)))) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
608 (error)))))) |
809 | 609 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
610 |
809 | 611 |
13388
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
612 (defun 2C-enlarge-window-horizontally (arg) |
809 | 613 "Make current window ARG columns wider." |
614 (interactive "p") | |
615 (enlarge-window arg t) | |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
616 (and (2C-other) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
617 (setq 2C-window-width (+ 2C-window-width arg)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
618 (set-buffer (2C-other)) |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
619 (setq 2C-window-width (- 2C-window-width arg)))) |
809 | 620 |
13388
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
621 (defun 2C-shrink-window-horizontally (arg) |
809 | 622 "Make current window ARG columns narrower." |
623 (interactive "p") | |
13388
af2bb7490ca9
(minor-mode-map-alist): Use substitute-key-definition
Karl Heuer <kwzh@gnu.org>
parents:
12934
diff
changeset
|
624 (2C-enlarge-window-horizontally (- arg))) |
809 | 625 |
12506
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
626 |
5dc02bbeb4be
Symbols renamed to be like mode-line indicator.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
627 |
1245
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
628 (provide 'two-column) |
f8a5da3d18e8
Use frame-width instead of screen-width.
Richard M. Stallman <rms@gnu.org>
parents:
923
diff
changeset
|
629 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
630 ;; arch-tag: 2021b5ab-d3a4-4a8c-a21c-1936b0f9e6b1 |
809 | 631 ;;; two-column.el ends here |