comparison lisp/replace.el @ 5686:c6b1500299a7

recenter-top-bottom synced from GNU and new default for C-l Partial implementation of recenter-top-bottom. GNU has support for scroll-margin that is not in XEmacs so that is left out. lisp/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * window-xemacs.el (recenter-positions): New defcustom. (recenter-top-bottom): New command. (recenter-last-op): New defvar. * replace.el (perform-replace): Let-bind recenter-last-op to nil. For def=recenter, replace `recenter' with `recenter-top-bottom' that is called with `this-command' and `last-command' let-bound to `recenter-top-bottom'. When the last `def' was not `recenter', set `recenter-last-op' to nil. * keydefs.el (global-map): Make recenter-top-bottom new default for C-l. etc/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * TUTORIAL: Updated due to recenter-top-bottom man/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * lispref/windows.texi (Vertical Scrolling): Added recenter-top-bottom and recenter-positions * xemacs/display.texi (Display): Rearranged and added documentation due to new function recenter-top-bottom.
author Mats Lidell <mats.lidell@cag.se>
date Tue, 18 Sep 2012 08:58:28 +0200
parents ac37a5f7e5be
children 0bddb59072b6
comparison
equal deleted inserted replaced
5685:aa5f38ecb804 5686:c6b1500299a7
1 ;;; replace.el --- search and replace commands for XEmacs. 1 ;;; replace.el --- search and replace commands for XEmacs.
2 2
3 ;; Copyright (C) 1985-7, 1992, 1994, 1997, 2003 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985-7, 1992, 1994, 1997, 2003, 2012 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: XEmacs Development Team 5 ;; Maintainer: XEmacs Development Team
6 ;; Keywords: dumped, matching 6 ;; Keywords: dumped, matching
7 7
8 ;; This file is part of XEmacs. 8 ;; This file is part of XEmacs.
557 (lastrepl nil) ;Position after last match considered. 557 (lastrepl nil) ;Position after last match considered.
558 ;; If non-nil, it is marker saying where in the buffer to 558 ;; If non-nil, it is marker saying where in the buffer to
559 ;; stop. 559 ;; stop.
560 (limit nil) 560 (limit nil)
561 (match-again t) 561 (match-again t)
562 (recenter-last-op nil) ; Start cycling order with initial position.
562 ;; XEmacs addition 563 ;; XEmacs addition
563 (qr-case-fold-search 564 (qr-case-fold-search
564 (if (and case-fold-search search-caps-disable-folding) 565 (if (and case-fold-search search-caps-disable-folding)
565 (no-upper-case-p search-string regexp-flag) 566 (no-upper-case-p search-string regexp-flag)
566 case-fold-search)) 567 case-fold-search))
698 (replace-match next-replacement nocasify literal)) 699 (replace-match next-replacement nocasify literal))
699 (setq done t query-flag nil replaced t)) 700 (setq done t query-flag nil replaced t))
700 ((eq def 'skip) 701 ((eq def 'skip)
701 (setq done t)) 702 (setq done t))
702 ((eq def 'recenter) 703 ((eq def 'recenter)
703 (recenter nil)) 704 ;; `this-command' has the value `query-replace',
705 ;; so we need to bind it to `recenter-top-bottom'
706 ;; to allow it to detect a sequence of `C-l'.
707 (let ((this-command 'recenter-top-bottom)
708 (last-command 'recenter-top-bottom))
709 (recenter-top-bottom)))
704 ((eq def 'edit) 710 ((eq def 'edit)
705 (store-match-data 711 (store-match-data
706 (prog1 (match-data) 712 (prog1 (match-data)
707 (save-excursion (recursive-edit)))) 713 (save-excursion (recursive-edit))))
708 ;; Before we make the replacement, 714 ;; Before we make the replacement,
722 (setq this-command 'mode-exited) 728 (setq this-command 'mode-exited)
723 (setq keep-going nil) 729 (setq keep-going nil)
724 (setq unread-command-events 730 (setq unread-command-events
725 (cons event unread-command-events)) 731 (cons event unread-command-events))
726 (setq done t)))) 732 (setq done t))))
733 (unless (eq def 'recenter)
734 ;; Reset recenter cycling order to initial position.
735 (setq recenter-last-op nil))
727 ;; Record previous position for ^ when we move on. 736 ;; Record previous position for ^ when we move on.
728 ;; Change markers to numbers in the match data 737 ;; Change markers to numbers in the match data
729 ;; since lots of markers slow down editing. 738 ;; since lots of markers slow down editing.
730 (setq stack 739 (setq stack
731 (cons (cons (point) 740 (cons (cons (point)