{"thread":{"id":"9319","subject":"[RFH PATCH] Teach the emacs git mode about core.excludesfile","startedAt":"2007-07-31T01:30:56Z","lastAt":"2007-07-31T01:30:56Z","messageCount":1,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"49176","messageId":"20070731012825.24170.68899.stgit@yoghurt","threadId":"9319","inReplyTo":null,"subject":"[RFH PATCH] Teach the emacs git mode about core.excludesfile","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-07-31T01:30:56Z","receivedAt":"2007-07-31T01:30:56Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"If there is a core.excludesfile option specified, let the emacs git\nmode take exclude patterns from that file, since that's what the docs\nsay, and what everyone else is already doing.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\nThe patch works, but the code is anything but pretty. I need help from\nsomeone who actually knows elisp!\n\n(Apologies if this patch reaches the list twice; the first copy I sent\nwas seemingly lost, so I tried another route.)\n\n contrib/emacs/git.el |   19 ++++++++++++++++---\n 1 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 53dd703..357e6d2 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -589,6 +589,13 @@ Return the list of files that haven't been handled.\"\n           (when node (push (ewoc-data node) unmerged-files))))\n       (git-set-files-state unmerged-files 'unmerged))))\n \n+(defun git-core-excludesfile ()\n+  \"The file core.excludesfile, or nil if it isn't specified.\"\n+  (let ((fn (git-config \"core.excludesfile\")))\n+    (if (and fn (file-readable-p fn))\n+        fn\n+      nil)))\n+\n (defun git-update-status-files (files &optional default-state)\n   \"Update the status of FILES from the index.\"\n   (unless git-status (error \"Not in git-status buffer.\"))\n@@ -600,9 +607,15 @@ Return the list of files that haven't been handled.\"\n     (git-run-ls-unmerged status files)\n     (when (and (or (not files) remaining-files)\n                (file-readable-p \".git/info/exclude\"))\n-      (setq remaining-files (git-run-ls-files status remaining-files\n-                                              'unknown \"-o\" \"--exclude-from=.git/info/exclude\"\n-                                              (concat \"--exclude-per-directory=\" git-per-dir-ignore-file))))\n+      (let ((ce (git-core-excludesfile)))\n+        (if ce\n+            (setq remaining-files (git-run-ls-files status remaining-files\n+                                                    'unknown \"-o\" \"--exclude-from=.git/info/exclude\"\n+                                                    (concat \"--exclude-per-directory=\" git-per-dir-ignore-file)\n+                                                    (concat \"--exclude-from=\" ce)))\n+          (setq remaining-files (git-run-ls-files status remaining-files\n+                                                  'unknown \"-o\" \"--exclude-from=.git/info/exclude\"\n+                                                  (concat \"--exclude-per-directory=\" git-per-dir-ignore-file))))))\n     ; mark remaining files with the default state (or remove them if nil)\n     (when remaining-files\n       (if default-state\n"}]}