All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Alexandre Julliard <julliard@winehq.org>
Cc: git@vger.kernel.org
Subject: [RFH PATCH] Teach the emacs git mode about core.excludesfile
Date: Tue, 31 Jul 2007 03:30:56 +0200	[thread overview]
Message-ID: <20070731012825.24170.68899.stgit@yoghurt> (raw)

If there is a core.excludesfile option specified, let the emacs git
mode take exclude patterns from that file, since that's what the docs
say, and what everyone else is already doing.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---

The patch works, but the code is anything but pretty. I need help from
someone who actually knows elisp!

(Apologies if this patch reaches the list twice; the first copy I sent
was seemingly lost, so I tried another route.)

 contrib/emacs/git.el |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 53dd703..357e6d2 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -589,6 +589,13 @@ Return the list of files that haven't been handled."
           (when node (push (ewoc-data node) unmerged-files))))
       (git-set-files-state unmerged-files 'unmerged))))
 
+(defun git-core-excludesfile ()
+  "The file core.excludesfile, or nil if it isn't specified."
+  (let ((fn (git-config "core.excludesfile")))
+    (if (and fn (file-readable-p fn))
+        fn
+      nil)))
+
 (defun git-update-status-files (files &optional default-state)
   "Update the status of FILES from the index."
   (unless git-status (error "Not in git-status buffer."))
@@ -600,9 +607,15 @@ Return the list of files that haven't been handled."
     (git-run-ls-unmerged status files)
     (when (and (or (not files) remaining-files)
                (file-readable-p ".git/info/exclude"))
-      (setq remaining-files (git-run-ls-files status remaining-files
-                                              'unknown "-o" "--exclude-from=.git/info/exclude"
-                                              (concat "--exclude-per-directory=" git-per-dir-ignore-file))))
+      (let ((ce (git-core-excludesfile)))
+        (if ce
+            (setq remaining-files (git-run-ls-files status remaining-files
+                                                    'unknown "-o" "--exclude-from=.git/info/exclude"
+                                                    (concat "--exclude-per-directory=" git-per-dir-ignore-file)
+                                                    (concat "--exclude-from=" ce)))
+          (setq remaining-files (git-run-ls-files status remaining-files
+                                                  'unknown "-o" "--exclude-from=.git/info/exclude"
+                                                  (concat "--exclude-per-directory=" git-per-dir-ignore-file))))))
     ; mark remaining files with the default state (or remove them if nil)
     (when remaining-files
       (if default-state

             reply	other threads:[~2007-07-31  1:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  1:30 Karl Hasselström [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-31  1:13 [RFH PATCH] Teach the emacs git mode about core.excludesfile Karl Hasselström
2007-07-31  1:58 ` Matthieu Moy
2007-07-31 10:36 ` Alexandre Julliard
2007-07-31 19:57   ` Karl Hasselström

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=20070731012825.24170.68899.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=git@vger.kernel.org \
    --cc=julliard@winehq.org \
    /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.
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.