diff options
| author | Stefan Monnier | 2004-01-27 22:54:45 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-01-27 22:54:45 +0000 |
| commit | e8a12926bbdb40c49e68e77cc614dd743c3d4c53 (patch) | |
| tree | ea40fb393f7a7deadca71eaa75783a7b780a0d07 | |
| parent | ce38070aa21d6d1e4853e022bdedca7e3d7a99b8 (diff) | |
| download | emacs-e8a12926bbdb40c49e68e77cc614dd743c3d4c53.tar.gz emacs-e8a12926bbdb40c49e68e77cc614dd743c3d4c53.zip | |
(easy-mmode-define-navigation): Use a more robust check of widening.
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 01e3e0af5ac..2439fdd4de6 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; easy-mmode.el --- easy definition for major and minor modes | 1 | ;;; easy-mmode.el --- easy definition for major and minor modes |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997,2000,01,02,03,2004 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr> | 5 | ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr> |
| 6 | ;; Maintainer: Stefan Monnier <monnier@gnu.org> | 6 | ;; Maintainer: Stefan Monnier <monnier@gnu.org> |
| @@ -433,14 +433,13 @@ found, do widen first and then call NARROWFUN with no args after moving." | |||
| 433 | (let* ((base-name (symbol-name base)) | 433 | (let* ((base-name (symbol-name base)) |
| 434 | (prev-sym (intern (concat base-name "-prev"))) | 434 | (prev-sym (intern (concat base-name "-prev"))) |
| 435 | (next-sym (intern (concat base-name "-next"))) | 435 | (next-sym (intern (concat base-name "-next"))) |
| 436 | (check-narrow-maybe (when narrowfun | 436 | (check-narrow-maybe |
| 437 | '(setq was-narrowed-p | 437 | (when narrowfun |
| 438 | (prog1 (or (/= (point-min) 1) | 438 | '(setq was-narrowed |
| 439 | (/= (point-max) | 439 | (prog1 (or (< (- (point-max) (point-min)) (buffer-size))) |
| 440 | (1+ (buffer-size)))) | 440 | (widen))))) |
| 441 | (widen))))) | ||
| 442 | (re-narrow-maybe (when narrowfun | 441 | (re-narrow-maybe (when narrowfun |
| 443 | `(when was-narrowed-p (,narrowfun))))) | 442 | `(when was-narrowed (,narrowfun))))) |
| 444 | (unless name (setq name base-name)) | 443 | (unless name (setq name base-name)) |
| 445 | `(progn | 444 | `(progn |
| 446 | (add-to-list 'debug-ignored-errors | 445 | (add-to-list 'debug-ignored-errors |
| @@ -451,7 +450,7 @@ found, do widen first and then call NARROWFUN with no args after moving." | |||
| 451 | (unless count (setq count 1)) | 450 | (unless count (setq count 1)) |
| 452 | (if (< count 0) (,prev-sym (- count)) | 451 | (if (< count 0) (,prev-sym (- count)) |
| 453 | (if (looking-at ,re) (setq count (1+ count))) | 452 | (if (looking-at ,re) (setq count (1+ count))) |
| 454 | (let (was-narrowed-p) | 453 | (let (was-narrowed) |
| 455 | ,check-narrow-maybe | 454 | ,check-narrow-maybe |
| 456 | (if (not (re-search-forward ,re nil t count)) | 455 | (if (not (re-search-forward ,re nil t count)) |
| 457 | (if (looking-at ,re) | 456 | (if (looking-at ,re) |
| @@ -472,7 +471,7 @@ found, do widen first and then call NARROWFUN with no args after moving." | |||
| 472 | (interactive) | 471 | (interactive) |
| 473 | (unless count (setq count 1)) | 472 | (unless count (setq count 1)) |
| 474 | (if (< count 0) (,next-sym (- count)) | 473 | (if (< count 0) (,next-sym (- count)) |
| 475 | (let (was-narrowed-p) | 474 | (let (was-narrowed) |
| 476 | ,check-narrow-maybe | 475 | ,check-narrow-maybe |
| 477 | (unless (re-search-backward ,re nil t count) | 476 | (unless (re-search-backward ,re nil t count) |
| 478 | (error "No previous %s" ,name)) | 477 | (error "No previous %s" ,name)) |