diff options
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/progmodes/hideshow.el | 82 |
2 files changed, 50 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c395b3c2a31..e7160dc9cbd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-10-18 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/hideshow.el: Rewrite one-armed `if' | ||
| 4 | constructs using either `when' or `unless'. | ||
| 5 | (hs-grok-mode-type): Elide superfluous `progn'; nfc. | ||
| 6 | |||
| 1 | 2003-10-16 Nick Roberts <nick@nick.uklinux.net> | 7 | 2003-10-16 Nick Roberts <nick@nick.uklinux.net> |
| 2 | 8 | ||
| 3 | * gdb-ui.el (breakpoint-xpm-data, breakpoint-enabled-pbm-data) | 9 | * gdb-ui.el (breakpoint-xpm-data, breakpoint-enabled-pbm-data) |
| @@ -37,22 +43,22 @@ | |||
| 37 | (set-fringe-style): Ditto. | 43 | (set-fringe-style): Ditto. |
| 38 | 44 | ||
| 39 | 2003-10-12 Michael Kifer <kifer@cs.stonybrook.edu> | 45 | 2003-10-12 Michael Kifer <kifer@cs.stonybrook.edu> |
| 40 | 46 | ||
| 41 | * ediff-mult.el (ediff-filegroup-action): Use | 47 | * ediff-mult.el (ediff-filegroup-action): Use |
| 42 | ediff-default-filtering-regexp. | 48 | ediff-default-filtering-regexp. |
| 43 | 49 | ||
| 44 | * ediff-util.el (ediff-recenter): Don't call | 50 | * ediff-util.el (ediff-recenter): Don't call |
| 45 | ediff-restore-highlighting twice. | 51 | ediff-restore-highlighting twice. |
| 46 | (ediff-select-difference): Set current difference. | 52 | (ediff-select-difference): Set current difference. |
| 47 | (ediff-unselect-and-select-difference): Added comment. | 53 | (ediff-unselect-and-select-difference): Added comment. |
| 48 | 54 | ||
| 49 | * ediff.el (ediff-directories,ediff-directory-revisions) | 55 | * ediff.el (ediff-directories,ediff-directory-revisions) |
| 50 | (ediff-directories3,ediff-merge-directories) | 56 | (ediff-directories3,ediff-merge-directories) |
| 51 | (ediff-merge-directories-with-ancestor) | 57 | (ediff-merge-directories-with-ancestor) |
| 52 | (ediff-merge-directory-revisions) | 58 | (ediff-merge-directory-revisions) |
| 53 | (ediff-merge-directory-revisions-with-ancestor): Use | 59 | (ediff-merge-directory-revisions-with-ancestor): Use |
| 54 | ediff-default-filtering-regexp. | 60 | ediff-default-filtering-regexp. |
| 55 | 61 | ||
| 56 | 2003-10-12 Andreas Schwab <schwab@suse.de> | 62 | 2003-10-12 Andreas Schwab <schwab@suse.de> |
| 57 | 63 | ||
| 58 | * international/mule-cmds.el (locale-charset-language-names): | 64 | * international/mule-cmds.el (locale-charset-language-names): |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index fbba8603b64..7013c3856e3 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -395,9 +395,9 @@ Note that `mode-line-format' is buffer-local.") | |||
| 395 | ; (setq buffer-invisibility-spec | 395 | ; (setq buffer-invisibility-spec |
| 396 | ; (cons arg buffer-invisibility-spec))))) | 396 | ; (cons arg buffer-invisibility-spec))))) |
| 397 | ; (defun remove-from-invisibility-spec (arg) | 397 | ; (defun remove-from-invisibility-spec (arg) |
| 398 | ; (if buffer-invisibility-spec | 398 | ; (when buffer-invisibility-spec |
| 399 | ; (setq buffer-invisibility-spec | 399 | ; (setq buffer-invisibility-spec |
| 400 | ; (delete arg buffer-invisibility-spec))))) | 400 | ; (delete arg buffer-invisibility-spec))))) |
| 401 | 401 | ||
| 402 | ;; hs-match-data | 402 | ;; hs-match-data |
| 403 | (defalias 'hs-match-data 'match-data) | 403 | (defalias 'hs-match-data 'match-data) |
| @@ -497,29 +497,29 @@ The block beginning is adjusted by `hs-adjust-block-beginning' | |||
| 497 | and then further adjusted to be at the end of the line." | 497 | and then further adjusted to be at the end of the line." |
| 498 | (if comment-reg | 498 | (if comment-reg |
| 499 | (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end) | 499 | (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end) |
| 500 | (if (looking-at hs-block-start-regexp) | 500 | (when (looking-at hs-block-start-regexp) |
| 501 | (let* ((mdata (hs-match-data t)) | 501 | (let* ((mdata (hs-match-data t)) |
| 502 | (pure-p (match-end 0)) | 502 | (pure-p (match-end 0)) |
| 503 | (p | 503 | (p |
| 504 | ;; `p' is the point at the end of the block beginning, | 504 | ;; `p' is the point at the end of the block beginning, |
| 505 | ;; which may need to be adjusted | 505 | ;; which may need to be adjusted |
| 506 | (save-excursion | 506 | (save-excursion |
| 507 | (goto-char (funcall (or hs-adjust-block-beginning | 507 | (goto-char (funcall (or hs-adjust-block-beginning |
| 508 | 'identity) | 508 | 'identity) |
| 509 | pure-p)) | 509 | pure-p)) |
| 510 | ;; whatever the adjustment, we move to eol | 510 | ;; whatever the adjustment, we move to eol |
| 511 | (end-of-line) | 511 | (end-of-line) |
| 512 | (point))) | 512 | (point))) |
| 513 | (q | 513 | (q |
| 514 | ;; `q' is the point at the end of the block | 514 | ;; `q' is the point at the end of the block |
| 515 | (progn (hs-forward-sexp mdata 1) | 515 | (progn (hs-forward-sexp mdata 1) |
| 516 | (end-of-line) | 516 | (end-of-line) |
| 517 | (point)))) | 517 | (point)))) |
| 518 | (if (and (< p (point)) (> (count-lines p q) 1)) | 518 | (when (and (< p (point)) (> (count-lines p q) 1)) |
| 519 | (overlay-put (hs-flag-region p q 'code) | 519 | (overlay-put (hs-flag-region p q 'code) |
| 520 | 'hs-ofs | 520 | 'hs-ofs |
| 521 | (- pure-p p))) | 521 | (- pure-p p))) |
| 522 | (goto-char (if end q (min p pure-p))))))) | 522 | (goto-char (if end q (min p pure-p))))))) |
| 523 | 523 | ||
| 524 | (defun hs-safety-is-job-n () | 524 | (defun hs-safety-is-job-n () |
| 525 | "Warn if `buffer-invisibility-spec' does not contain symbol `hs'." | 525 | "Warn if `buffer-invisibility-spec' does not contain symbol `hs'." |
| @@ -568,16 +568,16 @@ as cdr." | |||
| 568 | (setq p (point));; use this to avoid an infinite cycle | 568 | (setq p (point));; use this to avoid an infinite cycle |
| 569 | (forward-comment 1) | 569 | (forward-comment 1) |
| 570 | (skip-chars-forward " \t\n\f")) | 570 | (skip-chars-forward " \t\n\f")) |
| 571 | (if (or (not (looking-at hs-c-start-regexp)) | 571 | (when (or (not (looking-at hs-c-start-regexp)) |
| 572 | (> (point) q)) | 572 | (> (point) q)) |
| 573 | ;; we cannot hide this comment block | 573 | ;; we cannot hide this comment block |
| 574 | (setq not-hidable t))) | 574 | (setq not-hidable t))) |
| 575 | ;; goto the end of the comment | 575 | ;; goto the end of the comment |
| 576 | (forward-comment (buffer-size)) | 576 | (forward-comment (buffer-size)) |
| 577 | (skip-chars-backward " \t\n\f") | 577 | (skip-chars-backward " \t\n\f") |
| 578 | (end-of-line) | 578 | (end-of-line) |
| 579 | (if (>= (point) q) | 579 | (when (>= (point) q) |
| 580 | (list (if not-hidable nil p) (point)))))))) | 580 | (list (if not-hidable nil p) (point)))))))) |
| 581 | 581 | ||
| 582 | (defun hs-grok-mode-type () | 582 | (defun hs-grok-mode-type () |
| 583 | "Set up hideshow variables for new buffers. | 583 | "Set up hideshow variables for new buffers. |
| @@ -607,9 +607,8 @@ function; and adjust-block-beginning function." | |||
| 607 | c-start-regexp))) | 607 | c-start-regexp))) |
| 608 | hs-forward-sexp-func (or (nth 4 lookup) 'forward-sexp) | 608 | hs-forward-sexp-func (or (nth 4 lookup) 'forward-sexp) |
| 609 | hs-adjust-block-beginning (nth 5 lookup))) | 609 | hs-adjust-block-beginning (nth 5 lookup))) |
| 610 | (progn | 610 | (setq hs-minor-mode nil) |
| 611 | (setq hs-minor-mode nil) | 611 | (error "%s Mode doesn't support Hideshow Minor Mode" mode-name))) |
| 612 | (error "%s Mode doesn't support Hideshow Minor Mode" mode-name)))) | ||
| 613 | 612 | ||
| 614 | (defun hs-find-block-beginning () | 613 | (defun hs-find-block-beginning () |
| 615 | "Reposition point at block-start. | 614 | "Reposition point at block-start. |
| @@ -667,11 +666,11 @@ and `case-fold-search' are both t." | |||
| 667 | (if (and c-reg (nth 0 c-reg)) | 666 | (if (and c-reg (nth 0 c-reg)) |
| 668 | ;; point is inside a comment, and that comment is hidable | 667 | ;; point is inside a comment, and that comment is hidable |
| 669 | (goto-char (nth 0 c-reg)) | 668 | (goto-char (nth 0 c-reg)) |
| 670 | (if (and (not c-reg) | 669 | (when (and (not c-reg) |
| 671 | (hs-find-block-beginning) | 670 | (hs-find-block-beginning) |
| 672 | (looking-at hs-block-start-regexp)) | 671 | (looking-at hs-block-start-regexp)) |
| 673 | ;; point is inside a block | 672 | ;; point is inside a block |
| 674 | (goto-char (match-end 0))))) | 673 | (goto-char (match-end 0))))) |
| 675 | (end-of-line) | 674 | (end-of-line) |
| 676 | (let ((overlays (overlays-at (point))) | 675 | (let ((overlays (overlays-at (point))) |
| 677 | (found nil)) | 676 | (found nil)) |
| @@ -888,8 +887,7 @@ Key bindings: | |||
| 888 | ;; load-time actions | 887 | ;; load-time actions |
| 889 | 888 | ||
| 890 | ;; keymaps and menus | 889 | ;; keymaps and menus |
| 891 | (if hs-minor-mode-map | 890 | (unless hs-minor-mode-map |
| 892 | nil | ||
| 893 | (setq hs-minor-mode-map (make-sparse-keymap)) | 891 | (setq hs-minor-mode-map (make-sparse-keymap)) |
| 894 | (easy-menu-define hs-minor-mode-menu | 892 | (easy-menu-define hs-minor-mode-menu |
| 895 | hs-minor-mode-map | 893 | hs-minor-mode-map |