Skip to content

Commit d2b8383

Browse files
committed
Use setq-local and defvar-local
Can now use these macros as support only goes back to 24.3.
1 parent 44d8372 commit d2b8383

17 files changed

+96
-127
lines changed

ghci-script-mode.el

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,22 @@
3030
;;;###autoload
3131
(define-derived-mode ghci-script-mode text-mode "GHCi-Script"
3232
"Major mode for working with .ghci files."
33-
(set (make-local-variable 'adaptive-fill-mode) nil)
34-
(set (make-local-variable 'comment-start) "-- ")
35-
(set (make-local-variable 'comment-padding) 0)
36-
(set (make-local-variable 'comment-start-skip) "[-{]-[ \t]*")
37-
(set (make-local-variable 'comment-end) "")
38-
(set (make-local-variable 'comment-end-skip) "[ \t]*\\(-}\\|\\s>\\)")
39-
(set (make-local-variable 'indent-line-function) 'haskell-mode-suggest-indent-choice)
40-
(set (make-local-variable 'font-lock-defaults)
41-
'(ghci-script-mode-keywords t t nil nil))
42-
(set (make-local-variable 'indent-tabs-mode) nil)
43-
(set (make-local-variable 'tab-width) 8)
33+
(setq-local adaptive-fill-mode nil)
34+
(setq-local comment-start "-- ")
35+
(setq-local comment-padding 0)
36+
(setq-local comment-start-skip "[-{]-[ \t]*")
37+
(setq-local comment-end "")
38+
(setq-local comment-end-skip "[ \t]*\\(-}\\|\\s>\\)")
39+
(setq-local indent-line-function 'haskell-mode-suggest-indent-choice)
40+
(setq-local font-lock-defaults '(ghci-script-mode-keywords t t nil nil))
41+
(setq-local indent-tabs-mode nil)
42+
(setq-local tab-width 8)
4443
(when (boundp 'electric-indent-inhibit)
4544
(setq electric-indent-inhibit t))
46-
(set (make-local-variable 'dabbrev-case-fold-search) nil)
47-
(set (make-local-variable 'dabbrev-case-distinction) nil)
48-
(set (make-local-variable 'dabbrev-case-replace) nil)
49-
(set (make-local-variable 'dabbrev-abbrev-char-regexp) "\\sw\\|[.]")
45+
(setq-local dabbrev-case-fold-search nil)
46+
(setq-local dabbrev-case-distinction nil)
47+
(setq-local dabbrev-case-replace nil)
48+
(setq-local dabbrev-abbrev-char-regexp "\\sw\\|[.]")
5049
(setq haskell-literate nil))
5150

5251
;;;###autoload

haskell-cabal.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,16 @@ it from list if one of the following conditions are hold:
145145
;;;###autoload
146146
(define-derived-mode haskell-cabal-mode fundamental-mode "Haskell-Cabal"
147147
"Major mode for Cabal package description files."
148-
(set (make-local-variable 'font-lock-defaults)
149-
'(haskell-cabal-font-lock-keywords t t nil nil))
148+
(setq-local font-lock-defaults
149+
'(haskell-cabal-font-lock-keywords t t nil nil))
150150
(add-to-list 'haskell-cabal-buffers (current-buffer))
151151
(add-hook 'change-major-mode-hook 'haskell-cabal-unregister-buffer nil 'local)
152152
(add-hook 'kill-buffer-hook 'haskell-cabal-unregister-buffer nil 'local)
153-
(set (make-local-variable 'comment-start) "-- ")
154-
(set (make-local-variable 'comment-start-skip) "\\(^[ \t]*\\)--[ \t]*")
155-
(set (make-local-variable 'comment-end) "")
156-
(set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\n\\)")
157-
(set (make-local-variable 'indent-line-function) 'haskell-cabal-indent-line)
153+
(setq-local comment-start "-- ")
154+
(setq-local comment-start-skip "\\(^[ \t]*\\)--[ \t]*")
155+
(setq-local comment-end "")
156+
(setq-local comment-end-skip "[ \t]*\\(\\s>\\|\n\\)")
157+
(setq-local indent-line-function 'haskell-cabal-indent-line)
158158
(setq indent-tabs-mode nil)
159159
)
160160

haskell-checkers.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ name - user visible name for this mode"
154154
;;;###autoload
155155
(define-compilation-mode ,(intern (concat nm "-mode")) ,name
156156
,(concat "Mode to check Haskell source code using " name)
157-
(set (make-local-variable 'compilation-process-setup-function)
158-
',(intern (concat nm "-process-setup")))
159-
(set (make-local-variable 'compilation-disable-input) t)
160-
(set (make-local-variable 'compilation-scroll-output) nil)
161-
(set (make-local-variable 'compilation-finish-functions)
162-
(list ',(intern (concat nm "-finish-hook")))))
157+
(setq-local compilation-process-setup-function
158+
',(intern (concat nm "-process-setup")))
159+
(setq-local compilation-disable-input t)
160+
(setq-local compilation-scroll-output nil)
161+
(setq-local compilation-finish-functions
162+
(list ',(intern (concat nm "-finish-hook")))))
163163
;;;###autoload
164164
(defun ,(intern nm) ()
165165
,(concat "Run " name " for current buffer with haskell source")

haskell-compile.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ format is supported, as well as info-locations within compile
106106
messages pointing to additional source locations.
107107
108108
See Info node `(haskell-mode)compilation' for more details."
109-
(set (make-local-variable 'compilation-error-regexp-alist)
110-
haskell-compilation-error-regexp-alist)
109+
(setq-local compilation-error-regexp-alist
110+
haskell-compilation-error-regexp-alist)
111111

112112
(add-hook 'compilation-filter-hook
113113
'haskell-compilation-filter-hook nil t)

haskell-decl-scan.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,8 @@ Invokes `haskell-decl-scan-mode-hook' on activation."
604604
(local-set-key [menu-bar index] nil)))
605605

606606
(when haskell-decl-scan-mode
607-
(set (make-local-variable 'beginning-of-defun-function)
608-
'haskell-ds-backward-decl)
609-
(set (make-local-variable 'end-of-defun-function)
610-
'haskell-ds-forward-decl)
607+
(setq-local beginning-of-defun-function 'haskell-ds-backward-decl)
608+
(setq-local end-of-defun-function 'haskell-ds-forward-decl)
611609
(haskell-ds-imenu)))
612610

613611

haskell-doc.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@
315315
:prefix "haskell-doc-")
316316

317317

318-
(defvar haskell-doc-mode nil
318+
(defvar-local haskell-doc-mode nil
319319
"*If non-nil, show the type of the function near point or a related comment.
320320
321321
If the identifier near point is a Haskell keyword and the variable
@@ -343,17 +343,15 @@ in the alist `haskell-doc-user-defined-ids' and the variable
343343
`haskell-doc-show-user-defined' is non-nil show the type of the function.
344344
345345
This variable is buffer-local.")
346-
(make-variable-buffer-local 'haskell-doc-mode)
347346

348347
(defvar haskell-doc-mode-hook nil
349348
"Hook invoked when entering `haskell-doc-mode'.")
350349

351-
(defvar haskell-doc-index nil
350+
(defvar-local haskell-doc-index nil
352351
"Variable holding an alist matching file names to fct-type alists.
353352
The function `haskell-doc-make-global-fct-index' rebuilds this variables
354353
\(similar to an `imenu' rescan\).
355354
This variable is buffer-local.")
356-
(make-variable-buffer-local 'haskell-doc-index)
357355

358356
(defcustom haskell-doc-show-global-types nil
359357
"If non-nil, search for the types of global functions by loading the files.

haskell-font-lock.el

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,14 @@ like ::, class, instance, data, newtype, type."
544544

545545
(defun haskell-font-lock-defaults-create ()
546546
"Locally set `font-lock-defaults' for Haskell."
547-
(set (make-local-variable 'font-lock-defaults)
548-
'((haskell-font-lock-keywords)
549-
nil nil nil nil
550-
(font-lock-syntactic-face-function
551-
. haskell-syntactic-face-function)
552-
;; Get help from font-lock-syntactic-keywords.
553-
(parse-sexp-lookup-properties . t)
554-
(font-lock-extra-managed-props . (composition)))))
547+
(setq-local font-lock-defaults
548+
'((haskell-font-lock-keywords)
549+
nil nil nil nil
550+
(font-lock-syntactic-face-function
551+
. haskell-syntactic-face-function)
552+
;; Get help from font-lock-syntactic-keywords.
553+
(parse-sexp-lookup-properties . t)
554+
(font-lock-extra-managed-props . (composition)))))
555555

556556
(defun haskell-fontify-as-mode (text mode)
557557
"Fontify TEXT as MODE, returning the fontified text."

haskell-indent.el

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,9 +1489,8 @@ One indentation cycle is used."
14891489

14901490
;;; haskell-indent-mode
14911491

1492-
(defvar haskell-indent-mode nil
1492+
(defvar-local haskell-indent-mode nil
14931493
"Non-nil if the semi-intelligent Haskell indentation mode is in effect.")
1494-
(make-variable-buffer-local 'haskell-indent-mode)
14951494

14961495
(defvar haskell-indent-map
14971496
(let ((map (make-sparse-keymap)))
@@ -1517,8 +1516,8 @@ One indentation cycle is used."
15171516
(fboundp 'haskell-indentation-mode))
15181517
(haskell-indentation-mode 0))
15191518

1520-
(set (make-local-variable 'indent-line-function) 'haskell-indent-cycle)
1521-
(set (make-local-variable 'indent-region-function) 'haskell-indent-region)
1519+
(setq-local indent-line-function 'haskell-indent-cycle)
1520+
(setq-local indent-region-function 'haskell-indent-region)
15221521
(setq haskell-indent-mode t)
15231522
;; Activate our keymap.
15241523
(let ((map (current-local-map)))

haskell-indentation.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,8 @@ set and deleted as if they were real tabs."
111111
(when (and (bound-and-true-p haskell-simple-indent-mode)
112112
(fboundp 'haskell-simple-indent-mode))
113113
(haskell-simple-indent-mode 0))
114-
(set (make-local-variable 'indent-line-function)
115-
'haskell-indentation-indent-line)
116-
(set (make-local-variable 'indent-region-function)
117-
'haskell-indentation-indent-region)))
114+
(setq-local indent-line-function 'haskell-indentation-indent-line)
115+
(setq-local indent-region-function 'haskell-indentation-indent-region)))
118116

119117
;;;###autoload
120118
(defun turn-on-haskell-indentation ()

haskell-interactive-mode.el

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,12 @@
4242
(require 'cl-lib)
4343
(require 'etags)
4444

45-
(defvar haskell-interactive-mode-history-index)
46-
(make-variable-buffer-local 'haskell-interactive-mode-history-index)
45+
(defvar-local haskell-interactive-mode-history-index 0)
4746

48-
(defvar haskell-interactive-mode-history (list))
49-
(make-variable-buffer-local 'haskell-interactive-mode-history)
47+
(defvar-local haskell-interactive-mode-history (list))
5048

51-
(defvar haskell-interactive-mode-old-prompt-start
52-
nil
49+
(defvar-local haskell-interactive-mode-old-prompt-start nil
5350
"Mark used for the old beginning of the prompt.")
54-
(make-variable-buffer-local 'haskell-interactive-mode-old-prompt-start)
5551

5652
(defun haskell-interactive-prompt-regex ()
5753
"Generate a regex for searching for any occurence of the prompt\
@@ -111,11 +107,10 @@ Key bindings:
111107
"Mark used to figure out where the end of the current result output is.
112108
Used to distinguish betwen user input.")
113109

114-
(defvar haskell-interactive-previous-buffer nil
110+
(defvar-local haskell-interactive-previous-buffer nil
115111
"Records the buffer to which `haskell-interactive-switch-back' should jump.
116112
This is set by `haskell-interactive-switch', and should otherwise
117113
be nil.")
118-
(make-variable-buffer-local 'haskell-interactive-previous-buffer)
119114

120115
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121116
;; Hooks
@@ -327,8 +322,7 @@ SESSION, otherwise operate on the current buffer."
327322
(insert (substring prompt 0 1)
328323
(propertize (substring prompt 1)
329324
'front-sticky t)))
330-
(let ((marker (set (make-local-variable 'haskell-interactive-mode-prompt-start)
331-
(make-marker))))
325+
(let ((marker (setq-local haskell-interactive-mode-prompt-start (make-marker))))
332326
(set-marker marker (point)))
333327
(when haskell-interactive-mode-scroll-to-bottom
334328
(haskell-interactive-mode-scroll-to-bottom))))
@@ -346,8 +340,7 @@ SESSION, otherwise operate on the current buffer."
346340
'rear-nonsticky t
347341
'result t)))
348342
(haskell-interactive-mode-handle-h)
349-
(let ((marker (set (make-local-variable 'haskell-interactive-mode-result-end)
350-
(make-marker))))
343+
(let ((marker (setq-local haskell-interactive-mode-result-end (make-marker))))
351344
(set-marker marker
352345
(point)
353346
(current-buffer)))

0 commit comments

Comments
 (0)