Skip to content

Commit

Permalink
Fix defadvice warning
Browse files Browse the repository at this point in the history
- dtrt-indent.el:223:9: Warning: defvar
  ‘dtrt-indent-language-syntax-table’ docstring contains control char
  #x01 (position 629)
- dtrt-indent.el:223:9: Warning: defvar
  ‘dtrt-indent-language-syntax-table’ docstring contains control char
  #x02 (position 671)
  • Loading branch information
jamescherti committed Jan 29, 2025
1 parent 7c2243e commit c0ceaa1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions dtrt-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -1124,19 +1124,17 @@ Indentation offset set with file variable; not adjusted")
;;-----------------------------------------------------------------
;; Installation

(defadvice hack-one-local-variable
(before dtrt-indent-advise-hack-one-local-variable activate)
"Adviced by dtrt-indent.
Disable dtrt-indent if offset explicitly set."
(defun dtrt-indent-advise-hack-one-local-variable (var _val &rest _)
"Advice for `hack-one-local-variable' to disable dtrt-indent when necessary.
VAR corresponds to the first argument of `hack-one-local-variable'."
(cond
((eql (nth 2 (dtrt-indent--search-hook-mapping major-mode))
(ad-get-arg 0))
((eql (nth 2 (dtrt-indent--search-hook-mapping major-mode)) var)
(setq dtrt-indent-explicit-offset t))
((eql 'indent-tabs-mode
(ad-get-arg 0))
((eql 'indent-tabs-mode var)
(setq dtrt-indent-explicit-tab-mode t))))

(advice-add 'hack-one-local-variable :before #'dtrt-indent-advise-hack-one-local-variable)

(autoload 'dtrt-indent-diagnosis "dtrt-indent-diag"
"Guess indentation for the current buffer and output diagnostics."
t)
Expand Down

0 comments on commit c0ceaa1

Please sign in to comment.