comparison lisp/ediff-diff.el @ 36857:f6386773ce30

2001-03-17 Michael Kifer <kifer@cs.sunysb.edu> * ediff-util.el: Copyright years. (ediff-choose-syntax-table): New function. (ediff-setup): Use ediff-choose-syntax-table. * ediff-init.el (ediff-with-syntax-table): New macro, uses with-syntax-table. * ediff.el: Date of last update, copyright years. * ediff-wind (ediff-setup-control-frame): Nill->nil. * viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy of Scott Bronson. (ex-cmd-assoc,ex-cmd-one-letr): New functions. (viper-check-sub,viper-get-ex-command,viper-execute-ex-command): Deleted functions. (viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new ex-token-list. * viper-util.el: Spaces, indentation. * viper.el: Changed version, modification time.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 17 Mar 2001 18:59:39 +0000
parents 5d6b76d28b83
children 7a94f1c588c4
comparison
equal deleted inserted replaced
36856:e11fd97820c0 36857:f6386773ce30
1254 (> (skip-chars-forward ediff-word-4) 0) 1254 (> (skip-chars-forward ediff-word-4) 0)
1255 )) 1255 ))
1256 1256
1257 1257
1258 (defun ediff-wordify (beg end in-buffer out-buffer &optional control-buf) 1258 (defun ediff-wordify (beg end in-buffer out-buffer &optional control-buf)
1259 (let (inbuf-syntax-tbl sv-point string) 1259 (let (inbuf-syntax-tbl sv-point diff-string)
1260 (save-excursion 1260 (save-excursion
1261 (set-buffer in-buffer) 1261 (set-buffer in-buffer)
1262 (setq inbuf-syntax-tbl (syntax-table)) 1262 (setq inbuf-syntax-tbl
1263 (setq string (buffer-substring-no-properties beg end)) 1263 (if control-buf
1264 (ediff-with-current-buffer control-buf
1265 ediff-syntax-table)
1266 (syntax-table)))
1267 (setq diff-string (buffer-substring-no-properties beg end))
1264 1268
1265 (set-buffer out-buffer) 1269 (set-buffer out-buffer)
1266 ;; Make sure that temp buff syntax table is the same a the original buf 1270 ;; Make sure that temp buff syntax table is the same a the original buf
1267 ;; syntax tbl, because we use ediff-forward-word in both and 1271 ;; syntax tbl, because we use ediff-forward-word in both and
1268 ;; ediff-forward-word depends on the syntax classes of characters. 1272 ;; ediff-forward-word depends on the syntax classes of characters.
1269 (set-syntax-table inbuf-syntax-tbl) 1273 (set-syntax-table inbuf-syntax-tbl)
1270 (erase-buffer) 1274 (erase-buffer)
1271 (insert string) 1275 (insert diff-string)
1272 (goto-char (point-min)) 1276 (goto-char (point-min))
1273 (skip-chars-forward ediff-whitespace) 1277 (skip-chars-forward ediff-whitespace)
1274 (delete-region (point-min) (point)) 1278 (delete-region (point-min) (point))
1275 1279
1276 (while (not (eobp)) 1280 (while (not (eobp))
1277 ;; eval incontrol buf to let user create local versions for 1281 ;; eval in control buf to let user create local versions for
1278 ;; different invocations 1282 ;; different invocations
1279 (if control-buf 1283 (if control-buf
1280 (funcall 1284 (funcall
1281 (ediff-with-current-buffer 1285 (ediff-with-current-buffer control-buf
1282 control-buf ediff-forward-word-function)) 1286 ediff-forward-word-function))
1283 (funcall ediff-forward-word-function)) 1287 (funcall ediff-forward-word-function))
1284 (setq sv-point (point)) 1288 (setq sv-point (point))
1285 (skip-chars-forward ediff-whitespace) 1289 (skip-chars-forward ediff-whitespace)
1286 (delete-region sv-point (point)) 1290 (delete-region sv-point (point))
1287 (insert "\n"))))) 1291 (insert "\n")))))
1298 (insert string) 1302 (insert string)
1299 (goto-char (point-min))))) 1303 (goto-char (point-min)))))
1300 1304
1301 1305
1302 ;; goto word #n starting at current position in buffer `buf' 1306 ;; goto word #n starting at current position in buffer `buf'
1303 ;; For ediff, a word is either a string of a-z,A-Z, incl `-' and `_'; 1307 ;; For ediff, a word is determined by ediff-forward-word-function
1304 ;; or a string of other non-blanks. A blank is a \n\t\f
1305 ;; If `flag' is non-nil, goto the end of the n-th word. 1308 ;; If `flag' is non-nil, goto the end of the n-th word.
1306 (defun ediff-goto-word (n buf &optional flag) 1309 (defun ediff-goto-word (n buf &optional flag)
1307 ;; remember val ediff-forward-word-function has in ctl buf 1310 ;; remember val ediff-forward-word-function has in ctl buf
1308 (let ((fwd-word-fun ediff-forward-word-function)) 1311 (let ((fwd-word-fun ediff-forward-word-function)
1312 (syntax-tbl ediff-syntax-table))
1309 (ediff-with-current-buffer buf 1313 (ediff-with-current-buffer buf
1310 (skip-chars-forward ediff-whitespace) 1314 (skip-chars-forward ediff-whitespace)
1311 (while (> n 1) 1315 (while (> n 1)
1312 (funcall fwd-word-fun) 1316 (ediff-with-syntax-table syntax-tbl
1317 (funcall fwd-word-fun))
1313 (skip-chars-forward ediff-whitespace) 1318 (skip-chars-forward ediff-whitespace)
1314 (setq n (1- n))) 1319 (setq n (1- n)))
1315 (if (and flag (> n 0)) 1320 (if (and flag (> n 0))
1316 (funcall fwd-word-fun)) 1321 (funcall fwd-word-fun))
1317 (point)))) 1322 (point))))