comparison contrib/mercurial.el @ 4412:189a8ca52bfc

mercurial.el: move defmacro of hg-do-across-repo before use Macros must be defined before use to be byte-compiled properly.
author NIIMI Satoshi <sa2c@sa2c.net>
date Sat, 05 May 2007 15:50:40 +0900
parents 681b681f7f09
children b008deae9910
comparison
equal deleted inserted replaced
4411:681b681f7f09 4412:189a8ca52bfc
314 (if (not (eq (car res) 0)) 314 (if (not (eq (car res) 0))
315 (error "Mercurial command failed %s - exit code %s" 315 (error "Mercurial command failed %s - exit code %s"
316 (cons command args) 316 (cons command args)
317 (car res)) 317 (car res))
318 (cdr res)))) 318 (cdr res))))
319
320 (defmacro hg-do-across-repo (path &rest body)
321 (let ((root-name (gensym "root-"))
322 (buf-name (gensym "buf-")))
323 `(let ((,root-name (hg-root ,path)))
324 (save-excursion
325 (dolist (,buf-name (buffer-list))
326 (set-buffer ,buf-name)
327 (when (and hg-status (equal (hg-root buffer-file-name) ,root-name))
328 ,@body))))))
329
330 (put 'hg-do-across-repo 'lisp-indent-function 1)
319 331
320 (defun hg-sync-buffers (path) 332 (defun hg-sync-buffers (path)
321 "Sync buffers visiting PATH with their on-disk copies. 333 "Sync buffers visiting PATH with their on-disk copies.
322 If PATH is not being visited, but is under the repository root, sync 334 If PATH is not being visited, but is under the repository root, sync
323 all buffers visiting files in the repository." 335 all buffers visiting files in the repository."
537 (buf (find-buffer-visiting (concat root name)))) 549 (buf (find-buffer-visiting (concat root name))))
538 (when buf 550 (when buf
539 (set-buffer buf) 551 (set-buffer buf)
540 (hg-mode-line-internal status parents))))))) 552 (hg-mode-line-internal status parents)))))))
541 553
542 (defmacro hg-do-across-repo (path &rest body)
543 (let ((root-name (gensym "root-"))
544 (buf-name (gensym "buf-")))
545 `(let ((,root-name (hg-root ,path)))
546 (save-excursion
547 (dolist (,buf-name (buffer-list))
548 (set-buffer ,buf-name)
549 (when (and hg-status (equal (hg-root buffer-file-name) ,root-name))
550 ,@body))))))
551
552 (put 'hg-do-across-repo 'lisp-indent-function 1)
553
554 554
555 ;;; View mode bits. 555 ;;; View mode bits.
556 556
557 (defun hg-exit-view-mode (buf) 557 (defun hg-exit-view-mode (buf)
558 "Exit from hg-view-mode. 558 "Exit from hg-view-mode.