emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easy-mmode.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easy-mmode.el [lexbind]
Date: Thu, 20 Nov 2003 19:36:35 -0500

Index: emacs/lisp/emacs-lisp/easy-mmode.el
diff -c emacs/lisp/emacs-lisp/easy-mmode.el:1.38.2.2 
emacs/lisp/emacs-lisp/easy-mmode.el:1.38.2.3
*** emacs/lisp/emacs-lisp/easy-mmode.el:1.38.2.2        Tue Oct 14 19:32:21 2003
--- emacs/lisp/emacs-lisp/easy-mmode.el Thu Nov 20 19:36:07 2003
***************
*** 1,6 ****
  ;;; easy-mmode.el --- easy definition for major and minor modes
  
! ;; Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
  
  ;; Author: Georges Brun-Cottan <address@hidden>
  ;; Maintainer: Stefan Monnier <address@hidden>
--- 1,6 ----
  ;;; easy-mmode.el --- easy definition for major and minor modes
  
! ;; Copyright (C) 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  
  ;; Author: Georges Brun-Cottan <address@hidden>
  ;; Maintainer: Stefan Monnier <address@hidden>
***************
*** 419,425 ****
  ;;; easy-mmode-define-navigation
  ;;;
  
! (defmacro easy-mmode-define-navigation (base re &optional name endfun)
    "Define BASE-next and BASE-prev to navigate in the buffer.
  RE determines the places the commands should move point to.
  NAME should describe the entities matched by RE.  It is used to build
--- 419,425 ----
  ;;; easy-mmode-define-navigation
  ;;;
  
! (defmacro easy-mmode-define-navigation (base re &optional name endfun 
narrowfun)
    "Define BASE-next and BASE-prev to navigate in the buffer.
  RE determines the places the commands should move point to.
  NAME should describe the entities matched by RE.  It is used to build
***************
*** 427,436 ****
  BASE-next also tries to make sure that the whole entry is visible by
    searching for its end (by calling ENDFUN if provided or by looking for
    the next entry) and recentering if necessary.
! ENDFUN should return the end position (with or without moving point)."
    (let* ((base-name (symbol-name base))
         (prev-sym (intern (concat base-name "-prev")))
!        (next-sym (intern (concat base-name "-next"))))
      (unless name (setq name base-name))
      `(progn
         (add-to-list 'debug-ignored-errors
--- 427,446 ----
  BASE-next also tries to make sure that the whole entry is visible by
    searching for its end (by calling ENDFUN if provided or by looking for
    the next entry) and recentering if necessary.
! ENDFUN should return the end position (with or without moving point).
! NARROWFUN non-nil means to check for narrowing before moving, and if
! found, do widen first and then call NARROWFUN with no args after moving."
    (let* ((base-name (symbol-name base))
         (prev-sym (intern (concat base-name "-prev")))
!        (next-sym (intern (concat base-name "-next")))
!          (check-narrow-maybe (when narrowfun
!                                '(setq was-narrowed-p
!                                       (prog1 (or (/= (point-min) 1)
!                                                  (/= (point-max)
!                                                      (1+ (buffer-size))))
!                                         (widen)))))
!          (re-narrow-maybe (when narrowfun
!                             `(when was-narrowed-p (,narrowfun)))))
      (unless name (setq name base-name))
      `(progn
         (add-to-list 'debug-ignored-errors
***************
*** 440,466 ****
         (interactive)
         (unless count (setq count 1))
         (if (< count 0) (,prev-sym (- count))
!          (if (looking-at ,re) (incf count))
!          (if (not (re-search-forward ,re nil t count))
!              (if (looking-at ,re)
!                  (goto-char (or ,(if endfun `(,endfun)) (point-max)))
!                (error "No next %s" ,name))
!            (goto-char (match-beginning 0))
!            (when (and (eq (current-buffer) (window-buffer (selected-window)))
!                       (interactive-p))
!              (let ((endpt (or (save-excursion
!                                 ,(if endfun `(,endfun)
!                                    `(re-search-forward ,re nil t 2)))
!                               (point-max))))
!                (unless (pos-visible-in-window-p endpt nil t)
!                  (recenter '(0))))))))
         (defun ,prev-sym (&optional count)
         ,(format "Go to the previous COUNT'th %s" (or name base-name))
         (interactive)
         (unless count (setq count 1))
         (if (< count 0) (,next-sym (- count))
!          (unless (re-search-backward ,re nil t count)
!            (error "No previous %s" ,name)))))))
  
  (provide 'easy-mmode)
  
--- 450,483 ----
         (interactive)
         (unless count (setq count 1))
         (if (< count 0) (,prev-sym (- count))
!          (if (looking-at ,re) (setq count (1+ count)))
!            (let (was-narrowed-p)
!              ,check-narrow-maybe
!              (if (not (re-search-forward ,re nil t count))
!                  (if (looking-at ,re)
!                      (goto-char (or ,(if endfun `(,endfun)) (point-max)))
!                    (error "No next %s" ,name))
!                (goto-char (match-beginning 0))
!                (when (and (eq (current-buffer) (window-buffer 
(selected-window)))
!                           (interactive-p))
!                  (let ((endpt (or (save-excursion
!                                     ,(if endfun `(,endfun)
!                                        `(re-search-forward ,re nil t 2)))
!                                   (point-max))))
!                    (unless (pos-visible-in-window-p endpt nil t)
!                      (recenter '(0))))))
!              ,re-narrow-maybe)))
         (defun ,prev-sym (&optional count)
         ,(format "Go to the previous COUNT'th %s" (or name base-name))
         (interactive)
         (unless count (setq count 1))
         (if (< count 0) (,next-sym (- count))
!            (let (was-narrowed-p)
!              ,check-narrow-maybe
!              (unless (re-search-backward ,re nil t count)
!                (error "No previous %s" ,name))
!              ,re-narrow-maybe))))))
! 
  
  (provide 'easy-mmode)
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]