aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-08-26 15:31:59 +0000
committerStefan Monnier2005-08-26 15:31:59 +0000
commit797d92ed1f986579ab155e1f2df346eb31cc4085 (patch)
treec35c3230dff875196b48340d9fa5c044152f4b76
parent8248b7cace199410e36858d26436266b2bbd59a5 (diff)
downloademacs-797d92ed1f986579ab155e1f2df346eb31cc4085.tar.gz
emacs-797d92ed1f986579ab155e1f2df346eb31cc4085.zip
(outline-invent-heading): New fun.
(outline-promote, outline-demote): Use it. (outline-move-subtree-down): Remove unused vars `re' and `txt'. (outline-end-of-subtree): Remove unused var `opoint'.
-rw-r--r--lisp/ChangeLog17
-rw-r--r--lisp/outline.el52
2 files changed, 34 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0450dbdc61d..ff8086441c9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,14 +1,21 @@
12005-08-26 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * outline.el (outline-invent-heading): New fun.
4 (outline-promote, outline-demote): Use it.
5 (outline-move-subtree-down): Remove unused vars `re' and `txt'.
6 (outline-end-of-subtree): Remove unused var `opoint'.
7
12005-08-26 David Reitter <david.reitter@gmail.com> 82005-08-26 David Reitter <david.reitter@gmail.com>
2 9
3 * menu-bar.el (truncate-lines, write-file, print-buffer) 10 * menu-bar.el (truncate-lines, write-file, print-buffer)
4 (ps-print-buffer-faces, ps-print-buffer, split-window): Disable 11 (ps-print-buffer-faces, ps-print-buffer, split-window):
5 menu items when the frame they refer to is invisible, or when they 12 Disable menu items when the frame they refer to is invisible, or when
6 refer to a buffer and the minibuffer is selected. 13 they refer to a buffer and the minibuffer is selected.
7 14
82005-08-26 Pavel Kobiakov <pk_at_work@yahoo.com> 152005-08-26 Pavel Kobiakov <pk_at_work@yahoo.com>
9 16
10 * progmodes/flymake.el (flymake-highlight-err-lines): Use 17 * progmodes/flymake.el (flymake-highlight-err-lines):
11 save-excursion around flymake-highlight-line to preserve point. 18 Use save-excursion around flymake-highlight-line to preserve point.
12 19
132005-08-26 Eli Zaretskii <eliz@gnu.org> 202005-08-26 Eli Zaretskii <eliz@gnu.org>
14 21
diff --git a/lisp/outline.el b/lisp/outline.el
index 61968da99d7..714e7ec02ea 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -453,6 +453,20 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
453 (save-excursion (newline-and-indent))) 453 (save-excursion (newline-and-indent)))
454 (run-hooks 'outline-insert-heading-hook))) 454 (run-hooks 'outline-insert-heading-hook)))
455 455
456(defun outline-invent-heading (head up)
457 (save-match-data
458 ;; Let's try to invent one by repeating or deleting the last char.
459 (let ((new-head (if up (substring head 0 -1)
460 (concat head (substring head -1)))))
461 (if (string-match (concat "\\`\\(?:" outline-regexp "\\)")
462 new-head)
463 ;; Why bother checking that it is indeed higher/lower level ?
464 new-head
465 ;; Didn't work, so ask what to do.
466 (read-string (format "%s heading for `%s': "
467 (if up "Parent" "Demoted") head)
468 head nil nil t)))))
469
456(defun outline-promote (&optional children) 470(defun outline-promote (&optional children)
457 "Promote headings higher up the tree. 471 "Promote headings higher up the tree.
458If prefix argument CHILDREN is given, promote also all the children. 472If prefix argument CHILDREN is given, promote also all the children.
@@ -481,18 +495,8 @@ in the region."
481 (outline-up-heading 1 t) 495 (outline-up-heading 1 t)
482 (and (= (1- level) (funcall outline-level)) 496 (and (= (1- level) (funcall outline-level))
483 (match-string-no-properties 0)))) 497 (match-string-no-properties 0))))
484 ;; Bummer!! There is no lower level heading. 498 ;; Bummer!! There is no lower level heading.
485 ;; Let's try to invent one by deleting the last char. 499 (outline-invent-heading head 'up))))
486 (save-match-data
487 (let ((new-head (substring head 0 -1)))
488 (if (string-match (concat "\\`\\(?:" outline-regexp "\\)")
489 new-head)
490 ;; Why bother checking that it is indeed lower level ?
491 new-head
492 ;; Didn't work, so ask what to do.
493 (read-string (format "Parent heading for `%s': "
494 head)
495 head nil nil t)))))))
496 500
497 (unless (rassoc level outline-heading-alist) 501 (unless (rassoc level outline-heading-alist)
498 (push (cons head level) outline-heading-alist)) 502 (push (cons head level) outline-heading-alist))
@@ -532,18 +536,8 @@ in the region."
532 (unless (eobp) 536 (unless (eobp)
533 (looking-at outline-regexp) 537 (looking-at outline-regexp)
534 (match-string-no-properties 0)))) 538 (match-string-no-properties 0))))
535 (save-match-data 539 ;; Bummer!! There is no higher-level heading in the buffer.
536 ;; Bummer!! There is no higher-level heading in the buffer. 540 (outline-invent-heading head nil))))
537 ;; Let's try to invent one by repeating the last char.
538 (let ((new-head (concat head (substring head -1))))
539 (if (string-match (concat "\\`\\(?:" outline-regexp "\\)")
540 new-head)
541 ;; Why bother checking that it is indeed higher level ?
542 new-head
543 ;; Didn't work, so ask what to do.
544 (read-string (format "Demoted heading for `%s': "
545 head)
546 head nil nil t)))))))
547 541
548 (unless (rassoc level outline-heading-alist) 542 (unless (rassoc level outline-heading-alist)
549 (push (cons head level) outline-heading-alist)) 543 (push (cons head level) outline-heading-alist))
@@ -610,12 +604,11 @@ the match data is set appropriately."
610(defun outline-move-subtree-down (&optional arg) 604(defun outline-move-subtree-down (&optional arg)
611 "Move the currrent subtree down past ARG headlines of the same level." 605 "Move the currrent subtree down past ARG headlines of the same level."
612 (interactive "p") 606 (interactive "p")
613 (let ((re (concat "^\\(?:" outline-regexp "\\)")) 607 (let ((movfunc (if (> arg 0) 'outline-get-next-sibling
614 (movfunc (if (> arg 0) 'outline-get-next-sibling
615 'outline-get-last-sibling)) 608 'outline-get-last-sibling))
616 (ins-point (make-marker)) 609 (ins-point (make-marker))
617 (cnt (abs arg)) 610 (cnt (abs arg))
618 beg end txt folded) 611 beg end folded)
619 ;; Select the tree 612 ;; Select the tree
620 (outline-back-to-heading) 613 (outline-back-to-heading)
621 (setq beg (point)) 614 (setq beg (point))
@@ -883,8 +876,7 @@ Show the heading too, if it is currently invisible."
883 876
884(defun outline-end-of-subtree () 877(defun outline-end-of-subtree ()
885 (outline-back-to-heading) 878 (outline-back-to-heading)
886 (let ((opoint (point)) 879 (let ((first t)
887 (first t)
888 (level (funcall outline-level))) 880 (level (funcall outline-level)))
889 (while (and (not (eobp)) 881 (while (and (not (eobp))
890 (or first (> (funcall outline-level) level))) 882 (or first (> (funcall outline-level) level)))
@@ -1044,5 +1036,5 @@ convenient way to make a table of contents of the buffer."
1044(provide 'outline) 1036(provide 'outline)
1045(provide 'noutline) 1037(provide 'noutline)
1046 1038
1047;;; arch-tag: 1724410e-7d4d-4f46-b801-49e18171e874 1039;; arch-tag: 1724410e-7d4d-4f46-b801-49e18171e874
1048;;; outline.el ends here 1040;;; outline.el ends here