Mercurial > hg > xemacs-beta
comparison lisp/hyperbole/kotl/kvspec.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | c53a95d3c46d |
children | 4be1180a9e89 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
6 ;; KEYWORDS: outlines, wp | 6 ;; KEYWORDS: outlines, wp |
7 ;; | 7 ;; |
8 ;; AUTHOR: Bob Weiner | 8 ;; AUTHOR: Bob Weiner |
9 ;; | 9 ;; |
10 ;; ORIG-DATE: 21-Oct-95 at 15:17:07 | 10 ;; ORIG-DATE: 21-Oct-95 at 15:17:07 |
11 ;; LAST-MOD: 6-Mar-97 at 01:17:04 by Bob Weiner | 11 ;; LAST-MOD: 3-Nov-95 at 19:44:10 by Bob Weiner |
12 ;; | 12 ;; |
13 ;; This file is part of Hyperbole. | 13 ;; This file is part of Hyperbole. |
14 ;; Available for use and distribution under the same terms as GNU Emacs. | 14 ;; Available for use and distribution under the same terms as GNU Emacs. |
15 ;; | 15 ;; |
16 ;; Copyright (C) 1995, Free Software Foundation, Inc. | 16 ;; Copyright (C) 1995, Free Software Foundation, Inc. |
120 | 120 |
121 (defun kvspec:show-lines-per-cell (num) | 121 (defun kvspec:show-lines-per-cell (num) |
122 "Show NUM lines per cell." | 122 "Show NUM lines per cell." |
123 (if (and (integerp num) (>= num 0)) | 123 (if (and (integerp num) (>= num 0)) |
124 nil | 124 nil |
125 (error "(kvspec:show-lines-per-cell): Invalid lines per cell, `%d'" num)) | 125 (error "(kvspec:show-lines-per-cell): Invalid lines per cell, '%d'" num)) |
126 (kview:set-attr kview 'lines-to-show num) | 126 (kview:set-attr kview 'lines-to-show num) |
127 (let (start end count) | 127 (let (start end count) |
128 (if (zerop num) | 128 (if (zerop num) |
129 ;; Show all lines in cells. | 129 ;; Show all lines in cells. |
130 (kview:map-tree | 130 (kview:map-tree |
179 ;;; ************************************************************************ | 179 ;;; ************************************************************************ |
180 ;;; Private functions | 180 ;;; Private functions |
181 ;;; ************************************************************************ | 181 ;;; ************************************************************************ |
182 | 182 |
183 (defun kvspec:blank-lines () | 183 (defun kvspec:blank-lines () |
184 "Turn blank lines on or off according to `kvspec:current'." | 184 "Turn blank lines on or off according to 'kvspec:current'." |
185 (let ((modified-p (buffer-modified-p)) | 185 (let ((modified-p (buffer-modified-p)) |
186 (buffer-read-only)) | 186 (buffer-read-only)) |
187 (if (string-match "b" kvspec:current) | 187 (if (string-match "b" kvspec:current) |
188 ;; On | 188 ;; On |
189 (progn (kview:set-attr kview 'blank-lines t) | 189 (progn (kview:set-attr kview 'blank-lines t) |
232 (t (concat "n" (char-to-string | 232 (t (concat "n" (char-to-string |
233 (car (rassq (kview:label-type kview) | 233 (car (rassq (kview:label-type kview) |
234 kvspec:label-type-alist))))))))) | 234 kvspec:label-type-alist))))))))) |
235 | 235 |
236 (defun kvspec:elide () | 236 (defun kvspec:elide () |
237 "Turn ellipses display following clipped cells on or off according to `kvspec:current'." | 237 "Turn ellipses display following clipped cells on or off according to 'kvspec:current'." |
238 (setq selective-display-ellipses | 238 (setq selective-display-ellipses |
239 (if (string-match "e" kvspec:current) t))) | 239 (if (string-match "e" kvspec:current) t))) |
240 | 240 |
241 (defun kvspec:hide-levels () | 241 (defun kvspec:hide-levels () |
242 "Show a set number of cell levels according to `kvspec:current'." | 242 "Show a set number of cell levels according to 'kvspec:current'." |
243 ;; "l" means use value of kview:default-levels-to-show. | 243 ;; "l" means use value of kview:default-levels-to-show. |
244 ;; "l0" means show all levels. | 244 ;; "l0" means show all levels. |
245 (let (levels) | 245 (let (levels) |
246 (if (not (string-match "l\\([0-9]+\\)?" kvspec:current)) | 246 (if (not (string-match "l\\([0-9]+\\)?" kvspec:current)) |
247 ;; Don't change the view if no view spec is given but note that | 247 ;; Don't change the view if no view spec is given but note that |
254 (setq levels kview:default-levels-to-show)) | 254 (setq levels kview:default-levels-to-show)) |
255 (kview:set-attr kview 'levels-to-show levels) | 255 (kview:set-attr kview 'levels-to-show levels) |
256 (kvspec:levels-to-show levels)))) | 256 (kvspec:levels-to-show levels)))) |
257 | 257 |
258 (defun kvspec:lines-to-show () | 258 (defun kvspec:lines-to-show () |
259 "Show a set number of lines per cell according to `kvspec:current'." | 259 "Show a set number of lines per cell according to 'kvspec:current'." |
260 ;; "c" means use value of kview:default-lines-to-show. | 260 ;; "c" means use value of kview:default-lines-to-show. |
261 ;; "c0" means show all lines. | 261 ;; "c0" means show all lines. |
262 (cond ((not (string-match "c\\([0-9]+\\)?" kvspec:current)) | 262 (cond ((not (string-match "c\\([0-9]+\\)?" kvspec:current)) |
263 ;; Don't change the view if no view spec is given but note that all | 263 ;; Don't change the view if no view spec is given but note that all |
264 ;; lines should be shown in the future. | 264 ;; lines should be shown in the future. |
268 (string-to-int (substring kvspec:current (match-beginning 1) | 268 (string-to-int (substring kvspec:current (match-beginning 1) |
269 (match-end 1))))) | 269 (match-end 1))))) |
270 (t (kvspec:show-lines-per-cell kview:default-lines-to-show)))) | 270 (t (kvspec:show-lines-per-cell kview:default-lines-to-show)))) |
271 | 271 |
272 (defun kvspec:numbering () | 272 (defun kvspec:numbering () |
273 "Set the type of numbering (label) display according to `kvspec:current'." | 273 "Set the type of numbering (label) display according to 'kvspec:current'." |
274 (if (not (string-match "n\\([.*~0-2]\\)?" kvspec:current)) | 274 (if (not (string-match "n\\([.*~0-2]\\)?" kvspec:current)) |
275 nil | 275 nil |
276 ;; "n" means use value of kview:default-label-type. | 276 ;; "n" means use value of kview:default-label-type. |
277 ;; "n0" means display idstamps. | 277 ;; "n0" means display idstamps. |
278 ;; "n1" means display alpha labels. | 278 ;; "n1" means display alpha labels. |
295 (setq kvspec:string (format kvspec:string-format kvspec:current))) | 295 (setq kvspec:string (format kvspec:string-format kvspec:current))) |
296 (if (memq 'kvspec:string mode-line-format) | 296 (if (memq 'kvspec:string mode-line-format) |
297 nil | 297 nil |
298 (setq mode-line-format (copy-sequence mode-line-format)) | 298 (setq mode-line-format (copy-sequence mode-line-format)) |
299 (let ((elt (or (memq 'mode-line-buffer-identification mode-line-format) | 299 (let ((elt (or (memq 'mode-line-buffer-identification mode-line-format) |
300 (memq 'modeline-buffer-identification | 300 (memq 'modeline-buffer-identification mode-line-format)))) |
301 mode-line-format)))) | 301 (setcdr elt (cons 'kvspec:string (cdr elt)))))) |
302 (if elt | |
303 (setcdr elt (cons 'kvspec:string (cdr elt))) | |
304 ;; | |
305 ;; XEmacs 19.14 introduced extents into the modeline that we | |
306 ;; must work around. | |
307 (if (and hyperb:xemacs-p (string-lessp "19.14" hyperb:xemacs-p)) | |
308 (let ((mf modeline-format) | |
309 elt) | |
310 (while mf | |
311 (setq elt (car mf)) | |
312 (if (and (consp elt) (eq (cdr elt) 'modeline-buffer-identification)) | |
313 (progn (setcdr mf (cons 'kvspec:string (cdr mf))) | |
314 (setq mf nil))) | |
315 (setq mf (cdr mf))))))))) | |
316 | 302 |
317 (defun kvspec:update-view () | 303 (defun kvspec:update-view () |
318 "Update view according to current setting of local `kvspec:current' variable." | 304 "Update view according to current setting of local 'kvspec:current' variable." |
319 (let ((modified-p (buffer-modified-p)) | 305 (let ((modified-p (buffer-modified-p)) |
320 (buffer-read-only)) | 306 (buffer-read-only)) |
321 (save-excursion | 307 (save-excursion |
322 | 308 |
323 (if (string-match "a" kvspec:current) | 309 (if (string-match "a" kvspec:current) |
372 It is local to each koutline. Set this to nil to disable modeline display of | 358 It is local to each koutline. Set this to nil to disable modeline display of |
373 the view spec settings.") | 359 the view spec settings.") |
374 | 360 |
375 (defvar kvspec:string-format " <|%s>" | 361 (defvar kvspec:string-format " <|%s>" |
376 "Format of the kview spec modeline display. | 362 "Format of the kview spec modeline display. |
377 It must contain a `%s' which is replaced with the current set of view spec | 363 It must contain a '%s' which is replaced with the current set of view spec |
378 characters at run-time.") | 364 characters at run-time.") |
379 | 365 |
380 (provide 'kvspec) | 366 (provide 'kvspec) |