Mercurial > emacs
comparison lisp/textmodes/outline.el @ 10996:356f658dbd65
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 14 Mar 1995 00:33:40 +0000 |
parents | d1990c517cc9 |
children | 2c184ff2351d |
comparison
equal
deleted
inserted
replaced
10995:842974f9ab7d | 10996:356f658dbd65 |
---|---|
355 If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | 355 If FLAG is nil then text is shown, while if FLAG is t the text is hidden." |
356 (let ((inhibit-read-only t)) | 356 (let ((inhibit-read-only t)) |
357 (save-excursion | 357 (save-excursion |
358 (goto-char from) | 358 (goto-char from) |
359 (end-of-line) | 359 (end-of-line) |
360 (put-text-property (point) to 'invisible flag)))) | 360 (outline-discard-overlays (point) to 'outline) |
361 (if flag | |
362 (let ((o (make-overlay (point) to))) | |
363 (overlay-put o 'invisible flag) | |
364 (overlay-put o 'outline t)))))) | |
365 | |
366 (defun outline-discard-overlays (beg end prop) | |
367 (if (< end beg) | |
368 (setq beg (prog1 end (setq end beg)))) | |
369 (save-excursion | |
370 (goto-char beg) | |
371 (while (< (point) end) | |
372 (let ((overlays (overlays-at (point)))) | |
373 (while overlays | |
374 (let ((o (car overlays))) | |
375 (if (overlay-get o prop) | |
376 ;; Either push this overlay outside beg...end | |
377 ;; or split it to exclude beg...end | |
378 ;; or delete it entirely (if it is contained in beg...end). | |
379 (if (< (overlay-start o) beg) | |
380 (if (> (overlay-end o) end) | |
381 (let ((o1 (outline-copy-overlay o))) | |
382 (move-overlay o1 (overlay-start o1) beg) | |
383 (move-overlay o (overlay-start o) beg))) | |
384 (if (> (overlay-end o) end) | |
385 (move-overlay o end (overlay-end o)) | |
386 (delete-overlay o))))) | |
387 (setq overlays (cdr overlays)))) | |
388 (goto-char (next-overlay-change (point)))))) | |
389 | |
390 (defun outline-copy-overlay (o) | |
391 (let ((o1 (make-overlay (overlay-start o) (overlay-end o))) | |
392 (props (overlay-properties o))) | |
393 (while props | |
394 (overlay-put o1 (car props) (nth 1 props)) | |
395 (setq props (cdr (cdr props)))) | |
396 o1)) | |
361 | 397 |
362 (defun hide-entry () | 398 (defun hide-entry () |
363 "Hide the body directly following this heading." | 399 "Hide the body directly following this heading." |
364 (interactive) | 400 (interactive) |
365 (outline-back-to-heading) | 401 (outline-back-to-heading) |