comparison lisp/hyperbole/kotl/kvspec.el @ 36:c53a95d3c46d r19-15b101

Import from CVS: tag r19-15b101
author cvs
date Mon, 13 Aug 2007 08:53:38 +0200
parents 4103f0995bd7
children 131b0175ea99
comparison
equal deleted inserted replaced
35:279432d5c479 36:c53a95d3c46d
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: 4-Dec-96 at 15:36:12 by Bob Weiner 11 ;; LAST-MOD: 6-Mar-97 at 01:17:04 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.
313 (progn (setcdr mf (cons 'kvspec:string (cdr mf))) 313 (progn (setcdr mf (cons 'kvspec:string (cdr mf)))
314 (setq mf nil))) 314 (setq mf nil)))
315 (setq mf (cdr mf))))))))) 315 (setq mf (cdr mf)))))))))
316 316
317 (defun kvspec:update-view () 317 (defun kvspec:update-view ()
318 "Update view according to current setting of local 'kvspec:current' variable." 318 "Update view according to current setting of local `kvspec:current' variable."
319 (let ((modified-p (buffer-modified-p)) 319 (let ((modified-p (buffer-modified-p))
320 (buffer-read-only)) 320 (buffer-read-only))
321 (save-excursion 321 (save-excursion
322 322
323 (if (string-match "a" kvspec:current) 323 (if (string-match "a" kvspec:current)
372 It is local to each koutline. Set this to nil to disable modeline display of 372 It is local to each koutline. Set this to nil to disable modeline display of
373 the view spec settings.") 373 the view spec settings.")
374 374
375 (defvar kvspec:string-format " <|%s>" 375 (defvar kvspec:string-format " <|%s>"
376 "Format of the kview spec modeline display. 376 "Format of the kview spec modeline display.
377 It must contain a '%s' which is replaced with the current set of view spec 377 It must contain a `%s' which is replaced with the current set of view spec
378 characters at run-time.") 378 characters at run-time.")
379 379
380 (provide 'kvspec) 380 (provide 'kvspec)