From 2f893e7686c8f757e9a4f7993f4031c9ff5f74f7 Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Fri, 24 Mar 2023 07:30:15 +0100 Subject: Don't override buffer-local vars in ebuild-repo-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ebuild-mode.el (ebuild-repo-mode): Don't override variables if they already have a buffer-local binding. Signed-off-by: Ulrich Müller --- ChangeLog | 5 +++++ ebuild-mode.el | 17 +++++++++++------ 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 + + * ebuild-mode.el (ebuild-repo-mode): Don't override variables if + they already have a buffer-local binding. + 2023-03-20 Ulrich Müller * 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 () -- cgit v1.2.3-65-gdbad