comparison lisp/textmodes/outline.el @ 10998:2c184ff2351d

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Mar 1995 05:43:48 +0000
parents 356f658dbd65
children 4235784197f3
comparison
equal deleted inserted replaced
10997:66d853abce42 10998:2c184ff2351d
246 (if outline-minor-mode 246 (if outline-minor-mode
247 (progn 247 (progn
248 (make-local-variable 'line-move-ignore-invisible) 248 (make-local-variable 'line-move-ignore-invisible)
249 (setq line-move-ignore-invisible t) 249 (setq line-move-ignore-invisible t)
250 ;; Cause use of ellipses for invisible text. 250 ;; Cause use of ellipses for invisible text.
251 (setq buffer-invisibility-spec '((t . t)))) 251 (setq buffer-invisibility-spec '((t . t)))
252 (run-hooks 'outline-minor-mode-hook) 252 (run-hooks 'outline-minor-mode-hook))
253 (setq line-move-ignore-invisible nil) 253 (setq line-move-ignore-invisible nil)
254 ;; Cause use of ellipses for invisible text. 254 ;; Cause use of ellipses for invisible text.
255 (setq buffer-invisibility-spec t)) 255 (setq buffer-invisibility-spec t))
256 ;; When turning off outline mode, get rid of any invisible props. 256 ;; When turning off outline mode, get rid of any outline hiding.
257 (or outline-minor-mode 257 (or outline-minor-mode
258 (outline-flag-region (point-min) (point-max) nil)) 258 (show-all))
259 (set-buffer-modified-p (buffer-modified-p))) 259 (set-buffer-modified-p (buffer-modified-p)))
260 260
261 (defvar outline-level 'outline-level 261 (defvar outline-level 'outline-level
262 "Function of no args to compute a header's nesting level in an outline. 262 "Function of no args to compute a header's nesting level in an outline.
263 It can assume point is at the beginning of a header line.") 263 It can assume point is at the beginning of a header line.")
286 (forward-char -1))) 286 (forward-char -1)))
287 287
288 (defun outline-next-heading () 288 (defun outline-next-heading ()
289 "Move to the next (possibly invisible) heading line." 289 "Move to the next (possibly invisible) heading line."
290 (interactive) 290 (interactive)
291 (if (re-search-forward (concat "^\\(" outline-regexp "\\)") 291 (if (re-search-forward (concat "\n\\(" outline-regexp "\\)")
292 nil 'move) 292 nil 'move)
293 (goto-char (1+ (match-beginning 0))))) 293 (goto-char (1+ (match-beginning 0)))))
294 294
295 (defsubst outline-visible () 295 (defsubst outline-visible ()
296 "Non-nil if the character after point is visible." 296 "Non-nil if the character after point is visible."
361 (if flag 361 (if flag
362 (let ((o (make-overlay (point) to))) 362 (let ((o (make-overlay (point) to)))
363 (overlay-put o 'invisible flag) 363 (overlay-put o 'invisible flag)
364 (overlay-put o 'outline t)))))) 364 (overlay-put o 'outline t))))))
365 365
366 ;; Exclude from the region BEG ... END all overlays
367 ;; with a non-nil PROP property.
368 ;; Exclude them by shrinking them to exclude BEG ... END,
369 ;; or even by splitting them if necessary.
370 ;; Overlays without a non-nil PROP property are not touched.
366 (defun outline-discard-overlays (beg end prop) 371 (defun outline-discard-overlays (beg end prop)
367 (if (< end beg) 372 (if (< end beg)
368 (setq beg (prog1 end (setq end beg)))) 373 (setq beg (prog1 end (setq end beg))))
369 (save-excursion 374 (save-excursion
370 (goto-char beg) 375 (goto-char beg)
385 (move-overlay o end (overlay-end o)) 390 (move-overlay o end (overlay-end o))
386 (delete-overlay o))))) 391 (delete-overlay o)))))
387 (setq overlays (cdr overlays)))) 392 (setq overlays (cdr overlays))))
388 (goto-char (next-overlay-change (point)))))) 393 (goto-char (next-overlay-change (point))))))
389 394
395 ;; Make a copy of overlay O, with the same beginning, end and properties.
390 (defun outline-copy-overlay (o) 396 (defun outline-copy-overlay (o)
391 (let ((o1 (make-overlay (overlay-start o) (overlay-end o))) 397 (let ((o1 (make-overlay (overlay-start o) (overlay-end o)
398 (overlay-buffer o)))
392 (props (overlay-properties o))) 399 (props (overlay-properties o)))
393 (while props 400 (while props
394 (overlay-put o1 (car props) (nth 1 props)) 401 (overlay-put o1 (car props) (nth 1 props))
395 (setq props (cdr (cdr props)))) 402 (setq props (cdr (cdr props))))
396 o1)) 403 o1))