diff --git a/Makefile b/Makefile index 86ad1bb9b..69ec11e7a 100644 --- a/Makefile +++ b/Makefile @@ -27,8 +27,6 @@ EMACS := $(shell which "$${EMACS}" || which "emacs") EMACS_VERSION := $(shell "$(EMACS)" -Q --batch --eval '(princ emacs-version)') EFLAGS = --eval "(add-to-list 'load-path (expand-file-name \"tests/compat\") 'append)" \ - --eval "(when (< emacs-major-version 24) \ - (setq byte-compile-warnings '(not cl-functions)))" \ --eval '(setq byte-compile-error-on-warn t)' \ --eval '(when (not (version< emacs-version "24.4")) (setq load-prefer-newer t))' \ --eval '(defun byte-compile-dest-file (filename) \ @@ -50,8 +48,8 @@ PKG_DIST_FILES = $(ELFILES) logo.svg NEWS haskell-mode.info dir all: check-emacs-version compile $(AUTOLOADS) info check-emacs-version : - @$(BATCH) --eval "(when (< emacs-major-version 23) \ - (message \"Error: haskell-mode requires Emacs 23 or later\") \ + @$(BATCH) --eval "(when (version< emacs-version \"24.3\") \ + (message \"Error: haskell-mode requires Emacs 24.3 or later\") \ (message \"Your version of Emacs is %s\" emacs-version) \ (message \"Found as '$(EMACS)'\") \ (message \"Use one of:\") \ diff --git a/README.md b/README.md index c91efbe3e..716bb54b6 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ for setup and user guide. ## Installation - more information -`haskell-mode` supports GNU Emacs version 24 or later. +`haskell-mode` supports GNU Emacs version 24.3 or later. `haskell-mode` is available from [melpa-stable](http://stable.melpa.org) (releases) and [melpa](http://melpa.org) (git snapshots). diff --git a/doc/haskell-mode.texi b/doc/haskell-mode.texi index c3e7de775..efe564cd0 100644 --- a/doc/haskell-mode.texi +++ b/doc/haskell-mode.texi @@ -42,7 +42,7 @@ Front-Cover Texts and no Back-Cover Texts. @top Haskell Mode Haskell Mode is an Haskell development Environment for GNU Emacs version -24 or later. It provides syntax-based indentation, font locking, +24.3 or later. It provides syntax-based indentation, font locking, editing cabal files, and supports running an inferior Haskell interpreter (e.g. GHCi). @@ -167,7 +167,7 @@ The above steps should result in the following snippet in your @file{.emacs}: @section Installation - more information -@code{haskell-mode} supports GNU Emacs versions 24 and upcoming 25 +@code{haskell-mode} supports GNU Emacs versions 24.3+, including 25 (snapshot). @code{haskell-mode} is available from @@ -178,9 +178,9 @@ Other means of obtaining @code{haskell-mode} include @uref{https://github.com/dimitri/el-get, el-get}, @uref{https://github.com/bbatsov/prelude, Emacs Prelude} and @uref{https://packages.debian.org/search?keywords=haskell-mode, Debian package}. -Last version of @code{haskell-mode} that supported Emacs 23 is -@code{haskell-mode} 13.18 available at -@uref{https://github.com/haskell/haskell-mode/releases/tag/v13.18}. +Last version of @code{haskell-mode} that supported Emacs 23, 24.1, and 24.2 is +@code{haskell-mode} 13.16 available at +@uref{https://github.com/haskell/haskell-mode/releases/tag/v13.16}. @section Customizing diff --git a/ghci-script-mode.el b/ghci-script-mode.el index 320e717cf..d91423b9b 100644 --- a/ghci-script-mode.el +++ b/ghci-script-mode.el @@ -30,23 +30,22 @@ ;;;###autoload (define-derived-mode ghci-script-mode text-mode "GHCi-Script" "Major mode for working with .ghci files." - (set (make-local-variable 'adaptive-fill-mode) nil) - (set (make-local-variable 'comment-start) "-- ") - (set (make-local-variable 'comment-padding) 0) - (set (make-local-variable 'comment-start-skip) "[-{]-[ \t]*") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-end-skip) "[ \t]*\\(-}\\|\\s>\\)") - (set (make-local-variable 'indent-line-function) 'haskell-mode-suggest-indent-choice) - (set (make-local-variable 'font-lock-defaults) - '(ghci-script-mode-keywords t t nil nil)) - (set (make-local-variable 'indent-tabs-mode) nil) - (set (make-local-variable 'tab-width) 8) + (setq-local adaptive-fill-mode nil) + (setq-local comment-start "-- ") + (setq-local comment-padding 0) + (setq-local comment-start-skip "[-{]-[ \t]*") + (setq-local comment-end "") + (setq-local comment-end-skip "[ \t]*\\(-}\\|\\s>\\)") + (setq-local indent-line-function 'haskell-mode-suggest-indent-choice) + (setq-local font-lock-defaults '(ghci-script-mode-keywords t t nil nil)) + (setq-local indent-tabs-mode nil) + (setq-local tab-width 8) (when (boundp 'electric-indent-inhibit) (setq electric-indent-inhibit t)) - (set (make-local-variable 'dabbrev-case-fold-search) nil) - (set (make-local-variable 'dabbrev-case-distinction) nil) - (set (make-local-variable 'dabbrev-case-replace) nil) - (set (make-local-variable 'dabbrev-abbrev-char-regexp) "\\sw\\|[.]") + (setq-local dabbrev-case-fold-search nil) + (setq-local dabbrev-case-distinction nil) + (setq-local dabbrev-case-replace nil) + (setq-local dabbrev-abbrev-char-regexp "\\sw\\|[.]") (setq haskell-literate nil)) ;;;###autoload diff --git a/haskell-cabal.el b/haskell-cabal.el index 1819f5bdb..5416ea643 100644 --- a/haskell-cabal.el +++ b/haskell-cabal.el @@ -145,16 +145,16 @@ it from list if one of the following conditions are hold: ;;;###autoload (define-derived-mode haskell-cabal-mode fundamental-mode "Haskell-Cabal" "Major mode for Cabal package description files." - (set (make-local-variable 'font-lock-defaults) - '(haskell-cabal-font-lock-keywords t t nil nil)) + (setq-local font-lock-defaults + '(haskell-cabal-font-lock-keywords t t nil nil)) (add-to-list 'haskell-cabal-buffers (current-buffer)) (add-hook 'change-major-mode-hook 'haskell-cabal-unregister-buffer nil 'local) (add-hook 'kill-buffer-hook 'haskell-cabal-unregister-buffer nil 'local) - (set (make-local-variable 'comment-start) "-- ") - (set (make-local-variable 'comment-start-skip) "\\(^[ \t]*\\)--[ \t]*") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\n\\)") - (set (make-local-variable 'indent-line-function) 'haskell-cabal-indent-line) + (setq-local comment-start "-- ") + (setq-local comment-start-skip "\\(^[ \t]*\\)--[ \t]*") + (setq-local comment-end "") + (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\n\\)") + (setq-local indent-line-function 'haskell-cabal-indent-line) (setq indent-tabs-mode nil) ) diff --git a/haskell-checkers.el b/haskell-checkers.el index aa1ff50ef..8d5923ae1 100644 --- a/haskell-checkers.el +++ b/haskell-checkers.el @@ -154,12 +154,12 @@ name - user visible name for this mode" ;;;###autoload (define-compilation-mode ,(intern (concat nm "-mode")) ,name ,(concat "Mode to check Haskell source code using " name) - (set (make-local-variable 'compilation-process-setup-function) - ',(intern (concat nm "-process-setup"))) - (set (make-local-variable 'compilation-disable-input) t) - (set (make-local-variable 'compilation-scroll-output) nil) - (set (make-local-variable 'compilation-finish-functions) - (list ',(intern (concat nm "-finish-hook"))))) + (setq-local compilation-process-setup-function + ',(intern (concat nm "-process-setup"))) + (setq-local compilation-disable-input t) + (setq-local compilation-scroll-output nil) + (setq-local compilation-finish-functions + (list ',(intern (concat nm "-finish-hook"))))) ;;;###autoload (defun ,(intern nm) () ,(concat "Run " name " for current buffer with haskell source") diff --git a/haskell-compile.el b/haskell-compile.el index f1d1d0d98..fb9b74ed7 100644 --- a/haskell-compile.el +++ b/haskell-compile.el @@ -106,8 +106,8 @@ format is supported, as well as info-locations within compile messages pointing to additional source locations. See Info node `(haskell-mode)compilation' for more details." - (set (make-local-variable 'compilation-error-regexp-alist) - haskell-compilation-error-regexp-alist) + (setq-local compilation-error-regexp-alist + haskell-compilation-error-regexp-alist) (add-hook 'compilation-filter-hook 'haskell-compilation-filter-hook nil t) diff --git a/haskell-decl-scan.el b/haskell-decl-scan.el index 68d9d78e0..49ac80e78 100644 --- a/haskell-decl-scan.el +++ b/haskell-decl-scan.el @@ -604,10 +604,8 @@ Invokes `haskell-decl-scan-mode-hook' on activation." (local-set-key [menu-bar index] nil))) (when haskell-decl-scan-mode - (set (make-local-variable 'beginning-of-defun-function) - 'haskell-ds-backward-decl) - (set (make-local-variable 'end-of-defun-function) - 'haskell-ds-forward-decl) + (setq-local beginning-of-defun-function 'haskell-ds-backward-decl) + (setq-local end-of-defun-function 'haskell-ds-forward-decl) (haskell-ds-imenu))) diff --git a/haskell-doc.el b/haskell-doc.el index 8207d364d..1637c6725 100644 --- a/haskell-doc.el +++ b/haskell-doc.el @@ -315,7 +315,7 @@ :prefix "haskell-doc-") -(defvar haskell-doc-mode nil +(defvar-local haskell-doc-mode nil "*If non-nil, show the type of the function near point or a related comment. 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 `haskell-doc-show-user-defined' is non-nil show the type of the function. This variable is buffer-local.") -(make-variable-buffer-local 'haskell-doc-mode) (defvar haskell-doc-mode-hook nil "Hook invoked when entering `haskell-doc-mode'.") -(defvar haskell-doc-index nil +(defvar-local haskell-doc-index nil "Variable holding an alist matching file names to fct-type alists. The function `haskell-doc-make-global-fct-index' rebuilds this variables \(similar to an `imenu' rescan\). This variable is buffer-local.") -(make-variable-buffer-local 'haskell-doc-index) (defcustom haskell-doc-show-global-types nil "If non-nil, search for the types of global functions by loading the files. diff --git a/haskell-font-lock.el b/haskell-font-lock.el index e2a0015c2..a7a0425fe 100644 --- a/haskell-font-lock.el +++ b/haskell-font-lock.el @@ -544,14 +544,14 @@ like ::, class, instance, data, newtype, type." (defun haskell-font-lock-defaults-create () "Locally set `font-lock-defaults' for Haskell." - (set (make-local-variable 'font-lock-defaults) - '((haskell-font-lock-keywords) - nil nil nil nil - (font-lock-syntactic-face-function - . haskell-syntactic-face-function) - ;; Get help from font-lock-syntactic-keywords. - (parse-sexp-lookup-properties . t) - (font-lock-extra-managed-props . (composition))))) + (setq-local font-lock-defaults + '((haskell-font-lock-keywords) + nil nil nil nil + (font-lock-syntactic-face-function + . haskell-syntactic-face-function) + ;; Get help from font-lock-syntactic-keywords. + (parse-sexp-lookup-properties . t) + (font-lock-extra-managed-props . (composition))))) (defun haskell-fontify-as-mode (text mode) "Fontify TEXT as MODE, returning the fontified text." diff --git a/haskell-indent.el b/haskell-indent.el index 0d81d546e..8be99b1e0 100644 --- a/haskell-indent.el +++ b/haskell-indent.el @@ -1489,9 +1489,8 @@ One indentation cycle is used." ;;; haskell-indent-mode -(defvar haskell-indent-mode nil +(defvar-local haskell-indent-mode nil "Non-nil if the semi-intelligent Haskell indentation mode is in effect.") -(make-variable-buffer-local 'haskell-indent-mode) (defvar haskell-indent-map (let ((map (make-sparse-keymap))) @@ -1517,8 +1516,8 @@ One indentation cycle is used." (fboundp 'haskell-indentation-mode)) (haskell-indentation-mode 0)) - (set (make-local-variable 'indent-line-function) 'haskell-indent-cycle) - (set (make-local-variable 'indent-region-function) 'haskell-indent-region) + (setq-local indent-line-function 'haskell-indent-cycle) + (setq-local indent-region-function 'haskell-indent-region) (setq haskell-indent-mode t) ;; Activate our keymap. (let ((map (current-local-map))) diff --git a/haskell-indentation.el b/haskell-indentation.el index 296178ee7..725e2de1c 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -111,10 +111,8 @@ set and deleted as if they were real tabs." (when (and (bound-and-true-p haskell-simple-indent-mode) (fboundp 'haskell-simple-indent-mode)) (haskell-simple-indent-mode 0)) - (set (make-local-variable 'indent-line-function) - 'haskell-indentation-indent-line) - (set (make-local-variable 'indent-region-function) - 'haskell-indentation-indent-region))) + (setq-local indent-line-function 'haskell-indentation-indent-line) + (setq-local indent-region-function 'haskell-indentation-indent-region))) ;;;###autoload (defun turn-on-haskell-indentation () diff --git a/haskell-interactive-mode.el b/haskell-interactive-mode.el index 34f01e072..f0837e64e 100644 --- a/haskell-interactive-mode.el +++ b/haskell-interactive-mode.el @@ -42,16 +42,12 @@ (require 'cl-lib) (require 'etags) -(defvar haskell-interactive-mode-history-index) -(make-variable-buffer-local 'haskell-interactive-mode-history-index) +(defvar-local haskell-interactive-mode-history-index 0) -(defvar haskell-interactive-mode-history (list)) -(make-variable-buffer-local 'haskell-interactive-mode-history) +(defvar-local haskell-interactive-mode-history (list)) -(defvar haskell-interactive-mode-old-prompt-start - nil +(defvar-local haskell-interactive-mode-old-prompt-start nil "Mark used for the old beginning of the prompt.") -(make-variable-buffer-local 'haskell-interactive-mode-old-prompt-start) (defun haskell-interactive-prompt-regex () "Generate a regex for searching for any occurence of the prompt\ @@ -111,11 +107,10 @@ Key bindings: "Mark used to figure out where the end of the current result output is. Used to distinguish betwen user input.") -(defvar haskell-interactive-previous-buffer nil +(defvar-local haskell-interactive-previous-buffer nil "Records the buffer to which `haskell-interactive-switch-back' should jump. This is set by `haskell-interactive-switch', and should otherwise be nil.") -(make-variable-buffer-local 'haskell-interactive-previous-buffer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Hooks @@ -327,8 +322,7 @@ SESSION, otherwise operate on the current buffer." (insert (substring prompt 0 1) (propertize (substring prompt 1) 'front-sticky t))) - (let ((marker (set (make-local-variable 'haskell-interactive-mode-prompt-start) - (make-marker)))) + (let ((marker (setq-local haskell-interactive-mode-prompt-start (make-marker)))) (set-marker marker (point))) (when haskell-interactive-mode-scroll-to-bottom (haskell-interactive-mode-scroll-to-bottom)))) @@ -346,8 +340,7 @@ SESSION, otherwise operate on the current buffer." 'rear-nonsticky t 'result t))) (haskell-interactive-mode-handle-h) - (let ((marker (set (make-local-variable 'haskell-interactive-mode-result-end) - (make-marker)))) + (let ((marker (setq-local haskell-interactive-mode-result-end (make-marker)))) (set-marker marker (point) (current-buffer))) diff --git a/haskell-menu.el b/haskell-menu.el index 655a8fe41..7e1f1b0b7 100644 --- a/haskell-menu.el +++ b/haskell-menu.el @@ -61,8 +61,7 @@ Each line describes one session. Letters do not insert themselves; instead, they are commands." (setq buffer-read-only t) - (set (make-local-variable 'revert-buffer-function) - 'haskell-menu-revert-function) + (setq-local revert-buffer-function 'haskell-menu-revert-function) (setq truncate-lines t) (haskell-menu-revert-function nil t)) diff --git a/haskell-mode-pkg.el b/haskell-mode-pkg.el index 5ad9ed8a4..b2d7d1087 100644 --- a/haskell-mode-pkg.el +++ b/haskell-mode-pkg.el @@ -1,5 +1,5 @@ (define-package "haskell-mode" "16.1-git" "A Haskell editing mode" - '((emacs "24.1") (cl-lib "0.5")) + '((emacs "24.3")) :url "https://github.com/haskell/haskell-mode" :keywords '("haskell" "cabal" "ghc" "repl")) ;; Local Variables: diff --git a/haskell-mode.el b/haskell-mode.el index 78be1f885..96d0d5ebb 100644 --- a/haskell-mode.el +++ b/haskell-mode.el @@ -177,7 +177,7 @@ With prefix argument HERE, insert it at point." (outline-show-subtree))) ;; Are we looking at a literate script? -(defvar haskell-literate nil +(defvar-local haskell-literate nil "If not nil, the current buffer contains a literate Haskell script. Possible values are: `bird' and `tex', for Bird-style and LaTeX-style literate scripts respectively. Set by `haskell-mode' and @@ -185,7 +185,6 @@ literate scripts respectively. Set by `haskell-mode' and not contain either \"\\begin{code}\" or \"\\end{code}\" on a line on its own, nor does it contain \">\" at the start of a line -- the value of `haskell-literate-default' is used.") -(make-variable-buffer-local 'haskell-literate) (put 'haskell-literate 'safe-local-variable 'symbolp) ;; Default literate style for ambiguous literate buffers. @@ -786,47 +785,43 @@ Minor modes that work well with `haskell-mode': - `smerge-mode': show and work with diff3 conflict markers used by git, svn and other version control systems." :group 'haskell - (when (< emacs-major-version 24) - (error "haskell-mode requires at least Emacs 24")) + (when (version< emacs-version "24.3") + (error "haskell-mode requires at least Emacs 24.3")) ;; paragraph-{start,separate} should treat comments as paragraphs as well. - (set (make-local-variable 'paragraph-start) - (concat " *{-\\| *-- |\\|" page-delimiter)) - (set (make-local-variable 'paragraph-separate) - (concat " *$\\| *\\({-\\|-}\\) *$\\|" page-delimiter)) - (set (make-local-variable 'fill-paragraph-function) 'haskell-fill-paragraph) - ;; (set (make-local-variable 'adaptive-fill-function) 'haskell-adaptive-fill) - (set (make-local-variable 'adaptive-fill-mode) nil) - (set (make-local-variable 'comment-start) "-- ") - (set (make-local-variable 'comment-padding) 0) - (set (make-local-variable 'comment-start-skip) "[-{]-[ \t]*") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-end-skip) "[ \t]*\\(-}\\|\\s>\\)") - (set (make-local-variable 'forward-sexp-function) #'haskell-forward-sexp) - (set (make-local-variable 'parse-sexp-ignore-comments) nil) - (set (make-local-variable 'syntax-propertize-function) #'haskell-syntax-propertize) + (setq-local paragraph-start (concat " *{-\\| *-- |\\|" page-delimiter)) + (setq-local paragraph-separate (concat " *$\\| *\\({-\\|-}\\) *$\\|" page-delimiter)) + (setq-local fill-paragraph-function 'haskell-fill-paragraph) + ;; (setq-local adaptive-fill-function 'haskell-adaptive-fill) + (setq-local adaptive-fill-mode nil) + (setq-local comment-start "-- ") + (setq-local comment-padding 0) + (setq-local comment-start-skip "[-{]-[ \t]*") + (setq-local comment-end "") + (setq-local comment-end-skip "[ \t]*\\(-}\\|\\s>\\)") + (setq-local forward-sexp-function #'haskell-forward-sexp) + (setq-local parse-sexp-ignore-comments nil) + (setq-local syntax-propertize-function #'haskell-syntax-propertize) ;; Set things up for eldoc-mode. - (set (make-local-variable 'eldoc-documentation-function) - 'haskell-doc-current-info) + (setq-local eldoc-documentation-function 'haskell-doc-current-info) ;; Set things up for imenu. - (set (make-local-variable 'imenu-create-index-function) - 'haskell-ds-create-imenu-index) + (setq-local imenu-create-index-function 'haskell-ds-create-imenu-index) ;; Set things up for font-lock. - (set (make-local-variable 'font-lock-defaults) - '((haskell-font-lock-keywords) - nil nil nil nil - (font-lock-syntactic-face-function - . haskell-syntactic-face-function) - ;; Get help from font-lock-syntactic-keywords. - (parse-sexp-lookup-properties . t) - (font-lock-extra-managed-props . (composition haskell-type)))) + (setq-local font-lock-defaults + '((haskell-font-lock-keywords) + nil nil nil nil + (font-lock-syntactic-face-function + . haskell-syntactic-face-function) + ;; Get help from font-lock-syntactic-keywords. + (parse-sexp-lookup-properties . t) + (font-lock-extra-managed-props . (composition haskell-type)))) ;; Haskell's layout rules mean that TABs have to be handled with extra care. ;; The safer option is to avoid TABs. The second best is to make sure ;; TABs stops are 8 chars apart, as mandated by the Haskell Report. --Stef - (set (make-local-variable 'indent-tabs-mode) nil) - (set (make-local-variable 'tab-width) 8) - (set (make-local-variable 'comment-auto-fill-only-comments) t) + (setq-local indent-tabs-mode nil) + (setq-local tab-width 8) + (setq-local comment-auto-fill-only-comments t) ;; Haskell is not generally suitable for electric indentation, since ;; there is no unambiguously correct indent level for any given line. (when (boundp 'electric-indent-inhibit) @@ -834,10 +829,10 @@ Minor modes that work well with `haskell-mode': ;; dynamic abbrev support: recognize Haskell identifiers ;; Haskell is case-sensitive language - (set (make-local-variable 'dabbrev-case-fold-search) nil) - (set (make-local-variable 'dabbrev-case-distinction) nil) - (set (make-local-variable 'dabbrev-case-replace) nil) - (set (make-local-variable 'dabbrev-abbrev-char-regexp) "\\sw\\|[.]") + (setq-local dabbrev-case-fold-search nil) + (setq-local dabbrev-case-distinction nil) + (setq-local dabbrev-case-replace nil) + (setq-local dabbrev-abbrev-char-regexp "\\sw\\|[.]") (setq haskell-literate nil) (add-hook 'before-save-hook 'haskell-mode-before-save-handler nil t) (add-hook 'after-save-hook 'haskell-mode-after-save-handler nil t) @@ -963,9 +958,8 @@ list marker of some kind), and end of the obstacle." ;; fill-comment-paragraph isn't much use there, and even gets confused ;; by the syntax-table text-properties we add to mark the first char ;; of each line as a comment-starter. - (set (make-local-variable 'fill-paragraph-handle-comment) nil)) - (set (make-local-variable 'mode-line-process) - '("/" (:eval (symbol-name haskell-literate))))) + (setq-local fill-paragraph-handle-comment nil)) + (setq-local mode-line-process '("/" (:eval (symbol-name haskell-literate))))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[gh]s\\'" . haskell-mode)) diff --git a/haskell-presentation-mode.el b/haskell-presentation-mode.el index c60454578..e823b3023 100644 --- a/haskell-presentation-mode.el +++ b/haskell-presentation-mode.el @@ -85,7 +85,7 @@ buffer before presenting message." (with-current-buffer buffer (when (boundp 'shm-display-quarantine) - (set (make-local-variable 'shm-display-quarantine) nil)) + (setq-local shm-display-quarantine nil)) (when clear (haskell-presentation-clear)) (haskell-session-assign session) diff --git a/haskell-session.el b/haskell-session.el index 7d297bc64..cd487807e 100644 --- a/haskell-session.el +++ b/haskell-session.el @@ -36,9 +36,7 @@ ;; Globals ;; Used internally -(defvar haskell-session) - -(make-variable-buffer-local 'haskell-session) +(defvar-local haskell-session nil) (defvar haskell-sessions (list) "All Haskell sessions in the Emacs session.") @@ -92,7 +90,7 @@ This could be helpful for temporary or auxiliary buffers such as presentation mode buffers (e.g. in case when session is killed with all relevant buffers)." - (set (make-local-variable 'haskell-session) session)) + (setq-local haskell-session session)) (defun haskell-session-choose () "Find a session by choosing from a list of the current sessions." @@ -112,7 +110,7 @@ with all relevant buffers)." (defun haskell-session-clear () "Clear the buffer of any Haskell session choice." - (set (make-local-variable 'haskell-session) nil)) + (setq-local haskell-session nil)) (defun haskell-session-lookup (name) "Get the session by name." diff --git a/haskell-utils.el b/haskell-utils.el index 239bb8383..1126a2614 100644 --- a/haskell-utils.el +++ b/haskell-utils.el @@ -44,9 +44,8 @@ (eval-when-compile (require 'cl-lib)) -(defvar haskell-utils-async-post-command-flag nil +(defvar-local haskell-utils-async-post-command-flag nil "Non-nil means some commands were triggered during async function execution.") -(make-variable-buffer-local 'haskell-utils-async-post-command-flag) (defvar haskell-mode-interactive-prompt-state nil "Special variable indicating a state of user input waiting.") diff --git a/highlight-uses-mode.el b/highlight-uses-mode.el index 9cc324df0..722c96414 100644 --- a/highlight-uses-mode.el +++ b/highlight-uses-mode.el @@ -29,8 +29,7 @@ map) "Keymap for using `highlight-uses-mode'.") -(defvar highlight-uses-mode-point nil) -(make-variable-buffer-local 'highlight-uses-mode-point) +(defvar-local highlight-uses-mode-point nil) ;;;###autoload (define-minor-mode highlight-uses-mode diff --git a/inf-haskell.el b/inf-haskell.el index 8705042af..88e3da781 100644 --- a/inf-haskell.el +++ b/inf-haskell.el @@ -119,27 +119,26 @@ This will either look for a Cabal file or a \"module\" statement in the file." (define-derived-mode inferior-haskell-mode comint-mode "Inf-Haskell" "Major mode for interacting with an inferior Haskell process." :group 'inferior-haskell - (set (make-local-variable 'comint-prompt-regexp) - ;; Whay the backslash in [\\._[:alnum:]]? - "^\\*?[[:upper:]][\\._[:alnum:]]*\\(?: \\*?[[:upper:]][\\._[:alnum:]]*\\)*\\( λ\\)?> \\|^λ?> $") - (set (make-local-variable 'comint-input-autoexpand) nil) + (setq-local comint-prompt-regexp + ;; Why the backslash in [\\._[:alnum:]]? + "^\\*?[[:upper:]][\\._[:alnum:]]*\\(?: \\*?[[:upper:]][\\._[:alnum:]]*\\)*\\( λ\\)?> \\|^λ?> $") + (setq-local comint-input-autoexpand nil) (add-hook 'comint-preoutput-filter-functions 'inferior-haskell-send-decl-post-filter) (add-hook 'comint-output-filter-functions 'inferior-haskell-spot-prompt nil t) ;; Setup directory tracking. - (set (make-local-variable 'shell-cd-regexp) ":cd") + (setq-local shell-cd-regexp ":cd") (condition-case nil (shell-dirtrack-mode 1) (error ;The minor mode function may not exist or not accept an arg. - (set (make-local-variable 'shell-dirtrackp) t) + (setq-local shell-dirtrackp t) (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil 'local))) ;; Setup `compile' support so you can just use C-x ` and friends. - (set (make-local-variable 'compilation-error-regexp-alist) - inferior-haskell-error-regexp-alist) - (set (make-local-variable 'compilation-first-column) 0) ;GHCI counts from 0. + (setq-local compilation-error-regexp-alist inferior-haskell-error-regexp-alist) + (setq-local compilation-first-column 0) ;GHCI counts from 0. (if (and (not (boundp 'minor-mode-overriding-map-alist)) (fboundp 'compilation-shell-minor-mode)) ;; If we can't remove compilation-minor-mode bindings, at least try to @@ -210,8 +209,7 @@ setting up the inferior-haskell buffer." :type 'boolean :group 'inferior-haskell) -(defvar inferior-haskell-send-decl-post-filter-on nil) -(make-variable-buffer-local 'inferior-haskell-send-decl-post-filter-on) +(defvar-local inferior-haskell-send-decl-post-filter-on nil) (defun inferior-haskell-send-decl-post-filter (string) (when (and inferior-haskell-send-decl-post-filter-on @@ -225,8 +223,7 @@ setting up the inferior-haskell buffer." inferior-haskell-send-decl-post-filter-on nil)) string) -(defvar inferior-haskell-seen-prompt nil) -(make-variable-buffer-local 'inferior-haskell-seen-prompt) +(defvar-local inferior-haskell-seen-prompt nil) (defun inferior-haskell-spot-prompt (_string) (let ((proc (get-buffer-process (current-buffer)))) @@ -260,8 +257,7 @@ The process PROC should be associated to a comint buffer." ;; XEmacs needs this argument. (current-buffer)) inferior-haskell-cabal-buffer - (set (make-local-variable 'inferior-haskell-cabal-buffer) - (haskell-cabal-find-file)))))) + (setq-local inferior-haskell-cabal-buffer (haskell-cabal-find-file)))))) (defun inferior-haskell-find-project-root (buf) (with-current-buffer buf diff --git a/tests/compat/cl-lib.el b/tests/compat/cl-lib.el deleted file mode 100644 index cf13c565e..000000000 --- a/tests/compat/cl-lib.el +++ /dev/null @@ -1,372 +0,0 @@ -;;; cl-lib.el --- Properly prefixed CL functions and macros -*- coding: utf-8 -*- - -;; Copyright (C) 2012, 2013, 2014 Free Software Foundation, Inc. - -;; Author: Stefan Monnier -;; vcomment: Emacs-24.3's version is 1.0 so this has to stay below. -;; Version: 0.5 - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; This is a forward compatibility package, which provides (a subset of) the -;; features of the cl-lib package introduced in Emacs-24.3, for use on -;; previous emacsen. - -;; Make sure this is installed *late* in your `load-path`, i.e. after Emacs's -;; built-in .../lisp/emacs-lisp directory, so that if/when you upgrade to -;; Emacs-24.3, the built-in version of the file will take precedence, otherwise -;; you could get into trouble (although we try to hack our way around the -;; problem in case it happens). - -;; This code is largely copied from Emacs-24.3's cl.el, with the alias bindings -;; simply reversed. - -;;; Code: - -;; We need to handle the situation where this package is used with an Emacs -;; that comes with a real cl-lib (i.e. ≥24.3). - -;; First line of defense: try to make sure the built-in cl-lib comes earlier in -;; load-path so we never get loaded: -;;;###autoload (let ((d (file-name-directory #$))) -;;;###autoload (when (member d load-path) -;;;###autoload (setq load-path (append (remove d load-path) (list d))))) - -(when (functionp 'macroexp--compiler-macro) - ;; `macroexp--compiler-macro' was introduced as part of the big CL - ;; reorganization which moved/reimplemented some of CL into core (mostly the - ;; setf and compiler-macro support), so its presence indicates we're running - ;; in an Emacs that comes with the new cl-lib.el, where this file should - ;; never be loaded! - (message "Real cl-lib shadowed by compatibility cl-lib? (%s)" load-file-name) - (when load-file-name - ;; (message "Let's try to patch things up") - (let ((loaddir (file-name-directory load-file-name)) - load-path-dir) - ;; Find the problematic directory from load-path. - (dolist (dir load-path) - (if (equal loaddir (expand-file-name (file-name-as-directory dir))) - (setq load-path-dir dir))) - (when load-path-dir - ;; (message "Let's move the offending dir to the end") - (setq load-path (append (remove load-path-dir load-path) - (list load-path-dir))) - ;; Here we could manually load cl-lib and then return immediately. - ;; But Emacs currently doesn't provide any way for a file to "return - ;; immediately", so instead we make sure the rest of the file does not - ;; throw away any pre-existing definition. - )))) - -(require 'cl) - -;; Some of Emacs-24.3's cl.el definition are not just aliases, because either -;; the feature was dropped from cl-lib.el or because the cl-lib version is -;; not fully compatible. -;; Let's just not include them here, since it is very important that if code -;; works with this cl-lib.el it should also work with Emacs-24.3's cl-lib.el, -;; whereas the reverse is much less important. - -(dolist (var '( - ;; loop-result-var - ;; loop-result - ;; loop-initially - ;; loop-finally - ;; loop-bindings - ;; loop-args - ;; bind-inits - ;; bind-block - ;; lambda-list-keywords - float-negative-epsilon - float-epsilon - least-negative-normalized-float - least-positive-normalized-float - least-negative-float - least-positive-float - most-negative-float - most-positive-float - ;; custom-print-functions - )) - (let ((new (intern (format "cl-%s" var)))) - (unless (boundp new) (defvaralias new var)))) - -;; The following cl-lib functions were already defined in the old cl.el, -;; with a different meaning: -;; - cl-position and cl-delete-duplicates -;; the two meanings are clearly different, but we can distinguish which was -;; meant by looking at the arguments. -;; - cl-member -;; the old meaning hasn't been used for a long time and is a subset of the -;; new, so we can simply override it. -;; - cl-adjoin -;; the old meaning is actually the same as the new except for optimizations. - -(dolist (fun '( - (get* . cl-get) - (random* . cl-random) - (rem* . cl-rem) - (mod* . cl-mod) - (round* . cl-round) - (truncate* . cl-truncate) - (ceiling* . cl-ceiling) - (floor* . cl-floor) - (rassoc* . cl-rassoc) - (assoc* . cl-assoc) - ;; (member* . cl-member) ;Handle specially below. - (delete* . cl-delete) - (remove* . cl-remove) - (defsubst* . cl-defsubst) - (sort* . cl-sort) - (function* . cl-function) - (defmacro* . cl-defmacro) - (defun* . cl-defun) - (mapcar* . cl-mapcar) - - remprop - getf - tailp - list-length - nreconc - revappend - concatenate - subseq - random-state-p - make-random-state - signum - isqrt - lcm - gcd - notevery - notany - every - some - mapcon - mapcan - mapl - maplist - map - equalp - coerce - tree-equal - nsublis - sublis - nsubst-if-not - nsubst-if - nsubst - subst-if-not - subst-if - subsetp - nset-exclusive-or - set-exclusive-or - nset-difference - set-difference - nintersection - intersection - nunion - union - rassoc-if-not - rassoc-if - assoc-if-not - assoc-if - member-if-not - member-if - merge - stable-sort - search - mismatch - count-if-not - count-if - count - position-if-not - position-if - ;; position ;Handle specially via defadvice below. - find-if-not - find-if - find - nsubstitute-if-not - nsubstitute-if - nsubstitute - substitute-if-not - substitute-if - substitute - ;; delete-duplicates ;Handle specially via defadvice below. - remove-duplicates - delete-if-not - delete-if - remove-if-not - remove-if - replace - fill - reduce - compiler-macroexpand - define-compiler-macro - assert - check-type - typep - deftype - defstruct - callf2 - callf - letf* - letf - rotatef - shiftf - remf - psetf - declare - the - locally - multiple-value-setq - multiple-value-bind - symbol-macrolet - macrolet - progv - psetq - do-all-symbols - do-symbols - dotimes - dolist - do* - do - loop - return-from - return - block - etypecase - typecase - ecase - case - load-time-value - eval-when - destructuring-bind - gentemp - gensym - pairlis - acons - subst - ;; adjoin ;It's already defined. - copy-list - ldiff - list* - cddddr - cdddar - cddadr - cddaar - cdaddr - cdadar - cdaadr - cdaaar - cadddr - caddar - cadadr - cadaar - caaddr - caadar - caaadr - caaaar - cdddr - cddar - cdadr - cdaar - caddr - cadar - caadr - caaar - tenth - ninth - eighth - seventh - sixth - fifth - fourth - third - endp - rest - second - first - svref - copy-seq - evenp - oddp - minusp - plusp - floatp-safe - declaim - proclaim - nth-value - multiple-value-call - multiple-value-apply - multiple-value-list - values-list - values - pushnew - decf - incf - - dolist - dotimes - )) - (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun))) - (intern (format "cl-%s" fun))))) - (if (fboundp new) - (unless (or (eq (symbol-function new) fun) - (eq new (and (symbolp fun) (fboundp fun) - (symbol-function fun)))) - (message "%S already defined, not rebinding" new)) - (defalias new fun)))) - -(unless (symbolp (symbol-function 'position)) - (autoload 'cl-position "cl-seq") - (defadvice cl-position (around cl-lib (cl-item cl-seq &rest cl-keys) activate) - (let ((argk (ad-get-args 2))) - (if (or (null argk) (keywordp (car argk))) - ;; This is a call to cl-lib's `cl-position'. - (setq ad-return-value - (apply #'position (ad-get-arg 0) (ad-get-arg 1) argk)) - ;; Must be a call to cl's old `cl-position'. - ad-do-it)))) - -(unless (symbolp (symbol-function 'delete-duplicates)) - (autoload 'cl-delete-duplicates "cl-seq") - (defadvice cl-delete-duplicates (around cl-lib (cl-seq &rest cl-keys) activate) - (let ((argk (ad-get-args 1))) - (if (or (null argk) (keywordp (car argk))) - ;; This is a call to cl-lib's `cl-delete-duplicates'. - (setq ad-return-value - (apply #'delete-duplicates (ad-get-arg 0) argk)) - ;; Must be a call to cl's old `cl-delete-duplicates'. - ad-do-it)))) - -(when (or (not (fboundp 'cl-member)) - (eq (symbol-function 'cl-member) #'memq)) - (defalias 'cl-member #'member*)) - -;; `cl-labels' is not 100% compatible with `labels' when using dynamic scoping -;; (mostly because it does not turn lambdas that refer to those functions into -;; closures). OTOH it is compatible when using lexical scoping. - -(unless (fboundp 'cl-labels) - (defmacro cl-labels (&rest args) - (unless (and (boundp 'lexical-binding) lexical-binding) - ;; We used to signal an error rather than a message, but in many uses of - ;; cl-labels, the value of lexical-binding doesn't actually matter. - ;; More importantly, the value of `lexical-binding' here is unreliable - ;; (it does not necessarily reflect faithfully whether the output of this - ;; macro will be interpreted as lexically bound code or not). - (message "This `cl-labels' requires `lexical-binding' to be non-nil")) - `(labels ,@args))) - -(provide 'cl-lib) -;;; cl-lib.el ends here