summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-03-24 07:30:15 +0100
committerUlrich Müller <ulm@gentoo.org>2023-03-24 07:30:15 +0100
commit2f893e7686c8f757e9a4f7993f4031c9ff5f74f7 (patch)
tree8021abcede300566c4176e1d80a8c0f2da717cd8
parentNew function, visit Portage's working directory (diff)
downloadebuild-mode-2f893e7686c8f757e9a4f7993f4031c9ff5f74f7.tar.gz
ebuild-mode-2f893e7686c8f757e9a4f7993f4031c9ff5f74f7.tar.bz2
ebuild-mode-2f893e7686c8f757e9a4f7993f4031c9ff5f74f7.zip
Don't override buffer-local vars in ebuild-repo-mode
* ebuild-mode.el (ebuild-repo-mode): Don't override variables if they already have a buffer-local binding. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ChangeLog5
-rw-r--r--ebuild-mode.el17
2 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8739ce0..f765937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-24 Ulrich Müller <ulm@gentoo.org>
+
+ * ebuild-mode.el (ebuild-repo-mode): Don't override variables if
+ they already have a buffer-local binding.
+
2023-03-20 Ulrich Müller <ulm@gentoo.org>
* ebuild-mode.el (ebuild-mode-find-workdir): New function.
diff --git a/ebuild-mode.el b/ebuild-mode.el
index 3189b52..d3002a1 100644
--- a/ebuild-mode.el
+++ b/ebuild-mode.el
@@ -822,14 +822,19 @@ This will be added to the `write-contents-functions' hook."
;; make-local-hook gives a byte-compiler warning in GNU Emacs
(make-local-hook 'write-contents-hooks)
(add-hook 'write-contents-hooks 'ebuild-repo-mode-before-save t t))
- (setq fill-column 72)
- (setq tab-width 4)
+ (unless (local-variable-p 'fill-column)
+ (setq fill-column 72))
+ (unless (local-variable-p 'tab-width)
+ (setq tab-width 4))
(when (derived-mode-p 'nxml-mode)
(eval-when-compile (ignore-errors (require 'nxml-mode)))
- (let ((indent (if ebuild-mode-xml-indent-tabs 4 2)))
- (set (make-local-variable 'nxml-child-indent) indent)
- (set (make-local-variable 'nxml-attribute-indent) (* 2 indent)))
- (setq indent-tabs-mode ebuild-mode-xml-indent-tabs)))
+ (unless (or (local-variable-p 'nxml-child-indent)
+ (local-variable-p 'nxml-attribute-indent))
+ (let ((indent (if ebuild-mode-xml-indent-tabs 4 2)))
+ (set (make-local-variable 'nxml-child-indent) indent)
+ (set (make-local-variable 'nxml-attribute-indent) (* 2 indent))))
+ (unless (local-variable-p 'indent-tabs-mode)
+ (setq indent-tabs-mode ebuild-mode-xml-indent-tabs))))
;;;###autoload
(defun ebuild-repo-mode-maybe-enable ()