comparison lisp/ediff-util.el @ 106192:a2ee981efbec

2009-11-22 Michael Kifer <kifer@cs.stonybrook.edu> * viper-cmd.el: use viper-last-command-char instead of last-command-char/last-command-event. (viper-prefix-arg-value): do correct conversion of event-char for XEmacs. * viper-util.el, viper.el: use viper-last-command-char instead of last-command-char/last-command-event. * ediff-init.el, ediff-mult.el, ediff-util.el: relpace last-command-char and last-command-event with (ediff-last-command-char) everywhere. * ediff-vers.el (ediff-rcs-get-output-buffer): make sure the buffer is created in fundamental mode. * ediff.el (ediff-version): revert the change of interactive-p to called-interactively-p.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sun, 22 Nov 2009 03:14:14 +0000
parents 009383a57ce8
children 16d3ef458ae1
comparison
equal deleted inserted replaced
106191:baf1843cbc25 106192:a2ee981efbec
1009 If optional argument BUF is specified, toggle read-only in that buffer instead 1009 If optional argument BUF is specified, toggle read-only in that buffer instead
1010 of the current buffer." 1010 of the current buffer."
1011 (interactive) 1011 (interactive)
1012 (ediff-barf-if-not-control-buffer) 1012 (ediff-barf-if-not-control-buffer)
1013 (let ((ctl-buf (if (null buf) (current-buffer))) 1013 (let ((ctl-buf (if (null buf) (current-buffer)))
1014 (buf-type (ediff-char-to-buftype last-command-event))) 1014 (buf-type (ediff-char-to-buftype (ediff-last-command-char))))
1015 (or buf (ediff-recenter)) 1015 (or buf (ediff-recenter))
1016 (or buf 1016 (or buf
1017 (setq buf (ediff-get-buffer buf-type))) 1017 (setq buf (ediff-get-buffer buf-type)))
1018 1018
1019 (ediff-with-current-buffer buf ; eval in buf A/B/C 1019 (ediff-with-current-buffer buf ; eval in buf A/B/C
1511 (ediff-buffer-live-p ediff-buffer-C)) 1511 (ediff-buffer-live-p ediff-buffer-C))
1512 )) 1512 ))
1513 (error ediff-KILLED-VITAL-BUFFER)) 1513 (error ediff-KILLED-VITAL-BUFFER))
1514 1514
1515 (ediff-operate-on-windows 1515 (ediff-operate-on-windows
1516 (if (memq last-command-event '(?v ?\C-v)) 1516 (if (memq (ediff-last-command-char) '(?v ?\C-v))
1517 'scroll-up 1517 'scroll-up
1518 'scroll-down) 1518 'scroll-down)
1519 ;; calculate argument to scroll-up/down 1519 ;; calculate argument to scroll-up/down
1520 ;; if there is an explicit argument 1520 ;; if there is an explicit argument
1521 (if (and arg (not (equal arg '-))) 1521 (if (and arg (not (equal arg '-)))
1559 (ediff-operate-on-windows 1559 (ediff-operate-on-windows
1560 ;; Arrange for scroll-left and scroll-right being called 1560 ;; Arrange for scroll-left and scroll-right being called
1561 ;; interactively so that they set the window's min_hscroll. 1561 ;; interactively so that they set the window's min_hscroll.
1562 ;; Otherwise, automatic hscrolling will undo the effect of 1562 ;; Otherwise, automatic hscrolling will undo the effect of
1563 ;; hscrolling. 1563 ;; hscrolling.
1564 (if (= last-command-event ?<) 1564 (if (= (ediff-last-command-char) ?<)
1565 (lambda (arg) 1565 (lambda (arg)
1566 (let ((prefix-arg arg)) 1566 (let ((prefix-arg arg))
1567 (call-interactively 'scroll-left))) 1567 (call-interactively 'scroll-left)))
1568 (lambda (arg) 1568 (lambda (arg)
1569 (let ((prefix-arg arg)) 1569 (let ((prefix-arg arg))
1823 A is used. 1823 A is used.
1824 With a prefix argument, synchronize all files around the current point position 1824 With a prefix argument, synchronize all files around the current point position
1825 in the specified buffer." 1825 in the specified buffer."
1826 (interactive "P") 1826 (interactive "P")
1827 (ediff-barf-if-not-control-buffer) 1827 (ediff-barf-if-not-control-buffer)
1828 (let* ((buf-type (ediff-char-to-buftype last-command-event)) 1828 (let* ((buf-type (ediff-char-to-buftype (ediff-last-command-char)))
1829 (buffer (ediff-get-buffer buf-type)) 1829 (buffer (ediff-get-buffer buf-type))
1830 (pt (ediff-with-current-buffer buffer (point))) 1830 (pt (ediff-with-current-buffer buffer (point)))
1831 (diff-no (ediff-diff-at-point buf-type nil (if arg 'after))) 1831 (diff-no (ediff-diff-at-point buf-type nil (if arg 'after)))
1832 (past-last-diff (< ediff-number-of-differences diff-no)) 1832 (past-last-diff (< ediff-number-of-differences diff-no))
1833 (beg (if past-last-diff 1833 (beg (if past-last-diff
2159 2159
2160 (defun ediff-restore-diff (arg &optional key) 2160 (defun ediff-restore-diff (arg &optional key)
2161 "Restore ARGth diff from `ediff-killed-diffs-alist'. 2161 "Restore ARGth diff from `ediff-killed-diffs-alist'.
2162 ARG is a prefix argument. If ARG is nil, restore the current-difference. 2162 ARG is a prefix argument. If ARG is nil, restore the current-difference.
2163 If the second optional argument, a character, is given, use it to 2163 If the second optional argument, a character, is given, use it to
2164 determine the target buffer instead of last-command-event" 2164 determine the target buffer instead of (ediff-last-command-char)"
2165 (interactive "P") 2165 (interactive "P")
2166 (ediff-barf-if-not-control-buffer) 2166 (ediff-barf-if-not-control-buffer)
2167 (if (numberp arg) 2167 (if (numberp arg)
2168 (ediff-jump-to-difference arg)) 2168 (ediff-jump-to-difference arg))
2169 (ediff-pop-diff ediff-current-difference 2169 (ediff-pop-diff ediff-current-difference
2170 (ediff-char-to-buftype (or key last-command-event))) 2170 (ediff-char-to-buftype (or key (ediff-last-command-char))))
2171 ;; recenter with rehighlighting, but no messages 2171 ;; recenter with rehighlighting, but no messages
2172 (let (ediff-verbose-p) 2172 (let (ediff-verbose-p)
2173 (ediff-recenter))) 2173 (ediff-recenter)))
2174 2174
2175 (defun ediff-restore-diff-in-merge-buffer (arg) 2175 (defun ediff-restore-diff-in-merge-buffer (arg)
2189 (regexp-C "") 2189 (regexp-C "")
2190 msg-connective alt-msg-connective alt-connective) 2190 msg-connective alt-msg-connective alt-connective)
2191 (cond 2191 (cond
2192 ((or (and (eq ediff-skip-diff-region-function 2192 ((or (and (eq ediff-skip-diff-region-function
2193 ediff-focus-on-regexp-matches-function) 2193 ediff-focus-on-regexp-matches-function)
2194 (eq last-command-event ?f)) 2194 (eq (ediff-last-command-char) ?f))
2195 (and (eq ediff-skip-diff-region-function 2195 (and (eq ediff-skip-diff-region-function
2196 ediff-hide-regexp-matches-function) 2196 ediff-hide-regexp-matches-function)
2197 (eq last-command-event ?h))) 2197 (eq (ediff-last-command-char) ?h)))
2198 (message "Selective browsing by regexp turned off") 2198 (message "Selective browsing by regexp turned off")
2199 (setq ediff-skip-diff-region-function 'ediff-show-all-diffs)) 2199 (setq ediff-skip-diff-region-function 'ediff-show-all-diffs))
2200 ((eq last-command-event ?h) 2200 ((eq (ediff-last-command-char) ?h)
2201 (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function 2201 (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function
2202 regexp-A 2202 regexp-A
2203 (read-string 2203 (read-string
2204 (format 2204 (format
2205 "Ignore A-regions matching this regexp (default %s): " 2205 "Ignore A-regions matching this regexp (default %s): "
2233 2233
2234 (or (string= regexp-A "") (setq ediff-regexp-hide-A regexp-A)) 2234 (or (string= regexp-A "") (setq ediff-regexp-hide-A regexp-A))
2235 (or (string= regexp-B "") (setq ediff-regexp-hide-B regexp-B)) 2235 (or (string= regexp-B "") (setq ediff-regexp-hide-B regexp-B))
2236 (or (string= regexp-C "") (setq ediff-regexp-hide-C regexp-C))) 2236 (or (string= regexp-C "") (setq ediff-regexp-hide-C regexp-C)))
2237 2237
2238 ((eq last-command-event ?f) 2238 ((eq (ediff-last-command-char) ?f)
2239 (setq ediff-skip-diff-region-function 2239 (setq ediff-skip-diff-region-function
2240 ediff-focus-on-regexp-matches-function 2240 ediff-focus-on-regexp-matches-function
2241 regexp-A 2241 regexp-A
2242 (read-string 2242 (read-string
2243 (format 2243 (format
3299 \(and plain output, if customized output was not generated\)." 3299 \(and plain output, if customized output was not generated\)."
3300 (interactive "P") 3300 (interactive "P")
3301 (ediff-barf-if-not-control-buffer) 3301 (ediff-barf-if-not-control-buffer)
3302 (ediff-compute-custom-diffs-maybe) 3302 (ediff-compute-custom-diffs-maybe)
3303 (ediff-with-current-buffer 3303 (ediff-with-current-buffer
3304 (cond ((memq last-command-event '(?a ?b ?c)) 3304 (cond ((memq (ediff-last-command-char) '(?a ?b ?c))
3305 (ediff-get-buffer 3305 (ediff-get-buffer
3306 (ediff-char-to-buftype last-command-event))) 3306 (ediff-char-to-buftype (ediff-last-command-char))))
3307 ((eq last-command-event ?d) 3307 ((eq (ediff-last-command-char) ?d)
3308 (message "Saving diff output ...") 3308 (message "Saving diff output ...")
3309 (sit-for 1) ; let the user see the message 3309 (sit-for 1) ; let the user see the message
3310 (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer)) 3310 (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer))
3311 ediff-diff-buffer) 3311 ediff-diff-buffer)
3312 ((ediff-buffer-live-p ediff-custom-diff-buffer) 3312 ((ediff-buffer-live-p ediff-custom-diff-buffer)