all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: vc-*-root finctions
Date: Wed, 20 Feb 2008 12:12:46 +0100	[thread overview]
Message-ID: <87skzn3mq9.fsf@ambire.localdomain> (raw)
In-Reply-To: <jwv63wkhaan.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 19 Feb 2008 17:06:09 -0500")

() Stefan Monnier <monnier@iro.umontreal.ca>
() Tue, 19 Feb 2008 17:06:09 -0500

   Could you explain what the vc-*-root are supposed to do?

Would this blurb in vc.el Commentary explain things sufficiently?

;; - root (dir)
;;
;;   Return DIR's "root" directory, that is, a parent directory of
;;   DIR for which the same backend as used for DIR applies.  If no
;;   such parent exists, this function should return DIR.

I am using vc-BACKEND-root for (work-in-progress, see below)
`vc-status-mode' munging.

thi


_________________________________________________________________
(defun vc-status-mode ()
  "Major mode for VC Status.
Prepare the buffer to begin with the lines:

Directory: DEFAULT-DIRECTORY
  Updated: YYYY-MM-DD HH:MM:SS

If the `default-directory' is under the project's \"root\"
directory, make its root component a button that can run
command `vc-status' there.

Keys do not self-insert; instead they do different things:
\\{vc-status-mode-map}"
  (buffer-disable-undo)
  (erase-buffer)
  (let* ((backend (vc-responsible-backend default-directory))
         (find-root (vc-find-backend-function backend 'root))
         (root (if find-root
                   (funcall find-root default-directory)
                 default-directory)))
    (setq major-mode 'vc-status-mode)
    (setq mode-name (format "VC-%s Status" backend))
    (insert "Directory: ")
    (if (or (not root) (string= root default-directory))
        (insert root)
      (let* ((root-fn (directory-file-name root))
             (parent (file-name-directory root-fn))
             (leaf (file-name-nondirectory root-fn)))
        (insert parent)
        (if (featurep 'button)
            (insert-text-button
             leaf
             'root root
             'action (lambda (button)
                       (vc-status (button-get button 'root)))
             'follow-link t)
          (insert leaf))
        (insert (substring default-directory (1- (length root))))))
    (insert "\n")
    (set (make-local-variable 'vc-status)
         (ewoc-create #'vc-status-printer
                      (format-time-string "  Updated: %F %T\n")))
    (use-local-map vc-status-mode-map)
    (setq buffer-read-only t)))




  reply	other threads:[~2008-02-20 11:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 22:06 vc-*-root finctions Stefan Monnier
2008-02-20 11:12 ` Thien-Thi Nguyen [this message]
2008-02-20 17:21   ` Stefan Monnier
2008-02-20 18:21     ` Thien-Thi Nguyen
2008-02-20 18:50       ` Dan Nicolaescu
2008-02-21 15:33         ` Thien-Thi Nguyen
2008-02-21 18:35           ` Dan Nicolaescu
2008-02-21 19:03             ` Tom Tromey
2008-02-21 20:06               ` Dan Nicolaescu
2008-02-21 19:33             ` Stefan Monnier
2008-02-21 19:01               ` Tom Tromey
2008-02-21 20:01                 ` Dan Nicolaescu
2008-02-21 19:50               ` Dan Nicolaescu
2008-02-22 14:41             ` Thien-Thi Nguyen
2008-02-22 15:42               ` Dan Nicolaescu
2008-02-22 17:34                 ` Thien-Thi Nguyen
2008-02-22 19:02                   ` Dan Nicolaescu
2008-02-22  2:42           ` Mike Mattie
2008-02-20 19:20       ` Stefan Monnier
2008-02-21 15:36         ` Thien-Thi Nguyen
2008-02-21 16:16           ` Stefan Monnier
2008-02-22 14:54             ` Thien-Thi Nguyen
2008-02-22 16:50               ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skzn3mq9.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.