Skip to content

Enable lexical binding in every source lisp file #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghc-core.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; ghc-core.el --- Syntax highlighting module for GHC Core
;;; ghc-core.el --- Syntax highlighting module for GHC Core -*- lexical-binding: t -*-

;; Copyright (C) 2010 Johan Tibell

Expand Down
2 changes: 1 addition & 1 deletion ghci-script-mode.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; ghci-script-mode.el --- GHCi scripts major mode
;;; ghci-script-mode.el --- GHCi scripts major mode -*- lexical-binding: t -*-

;; Copyright (c) 2014 Chris Done. All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion haskell-align-imports.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-align-imports.el --- Align the import lines in a Haskell file
;;; haskell-align-imports.el --- Align the import lines in a Haskell file -*- lexical-binding: t -*-

;; Copyright (C) 2010 Chris Done

Expand Down
2 changes: 1 addition & 1 deletion haskell-bot.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-bot.el --- A Lambdabot interaction mode
;;; haskell-bot.el --- A Lambdabot interaction mode -*- lexical-binding: t -*-

;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2001 Chris Webb
Expand Down
13 changes: 5 additions & 8 deletions haskell-cabal.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-cabal.el --- Support for Cabal packages
;;; haskell-cabal.el --- Support for Cabal packages -*- lexical-binding: t -*-

;; Copyright (C) 2007, 2008 Stefan Monnier

Expand Down Expand Up @@ -459,8 +459,7 @@ resultung buffer-content"
(,beg (plist-get ,section :beginning))
(,end (plist-get ,section :end))
(,start-col (plist-get ,section :data-start-column))
(,section-data (buffer-substring ,beg ,end))
(section-name (plist-get ,section :name )))
(,section-data (buffer-substring ,beg ,end)))
(save-excursion
(prog1
(with-temp-buffer
Expand Down Expand Up @@ -534,8 +533,7 @@ resultung buffer-content"
"Strip indentation from each line, execute FORMS and reinstate indentation
so that the indentation of the FIRST LINE matches"
(let ((old-l1-indent (make-symbol "new-l1-indent"))
(new-l1-indent (make-symbol "old-l1-indent"))
(res nil))
(new-l1-indent (make-symbol "old-l1-indent")))
`(let ( (,old-l1-indent (save-excursion
(goto-char (point-min))
(current-indentation))))
Expand Down Expand Up @@ -672,9 +670,9 @@ resultung buffer-content"
(let ((downcase-name (downcase name)))
(haskell-cabal-find-subsection-by
section
'(lambda (subsection)
`(lambda (subsection)
(string= (downcase (haskell-cabal-section-name subsection))
downcase-name)))))
,downcase-name)))))

(defun haskell-cabal-goto-subsection (name)
(let ((subsection (haskell-cabal-find-subsection (haskell-cabal-section) name)))
Expand Down Expand Up @@ -807,7 +805,6 @@ Source names from main-is and c-sources sections are left untouched
(if (null candidates)
(let* ((src-dir (haskell-cabal-join-paths base-dir (or (car src-dirs) "")))
(newfile (haskell-cabal-join-paths src-dir filename))
(subdir (file-name-directory newfile))
(do-create-p (y-or-n-p (format "Create file %s ?" newfile))))
(when do-create-p
(find-file-other-window newfile )))
Expand Down
6 changes: 3 additions & 3 deletions haskell-checkers.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-checkers.el --- Emacs interface to haskell lint and style checkers
;;; haskell-checkers.el --- Emacs interface to haskell lint and style checkers -*- lexical-binding: t -*-

;; Copyright (C) 2009-2011 Alex Ott, Liam O'Reilly
;;
Expand Down Expand Up @@ -128,13 +128,13 @@
(when (re-search-forward new-old-code eline t)
(replace-match new-code nil t)))))))

(defun haskell-lint-finish-hook (buf msg)
(defun haskell-lint-finish-hook (_buf _msg)
"Function, that is executed at the end of HLint or scan execution"
(if haskell-checkers-replace-with-suggestions
(haskell-lint-replace-suggestions)
(next-error 1 t)))

(defun haskell-scan-finish-hook (buf msg)
(defun haskell-scan-finish-hook (_buf _msg)
"Function, that is executed at the end of haskell-scan execution"
(next-error 1 t))

Expand Down
2 changes: 1 addition & 1 deletion haskell-collapse.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-collapse.el --- Collapse expressions
;;; haskell-collapse.el --- Collapse expressions -*- lexical-binding: t -*-

;; Copyright (c) 2014 Chris Done. All rights reserved.

Expand Down
24 changes: 12 additions & 12 deletions haskell-commands.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-commands.el --- Commands that can be run on the process
;;; haskell-commands.el --- Commands that can be run on the process -*- lexical-binding: t -*-

;;; Commentary:

Expand Down Expand Up @@ -343,7 +343,7 @@ should be inserted."
expr))))))

;;;###autoload
(defun haskell-mode-jump-to-def-or-tag (&optional next-p)
(defun haskell-mode-jump-to-def-or-tag (&optional _next-p)
;; FIXME NEXT-P arg is not used
"Jump to the definition.
Jump to definition of identifier at point by consulting GHCi, or
Expand Down Expand Up @@ -513,7 +513,7 @@ Requires the :loc-at command from GHCi."
'face 'compilation-error)))))))

;;;###autoload
(defun haskell-process-cd (&optional not-interactive)
(defun haskell-process-cd (&optional _not-interactive)
;; FIXME optional arg is not used
"Change directory."
(interactive)
Expand Down Expand Up @@ -585,7 +585,7 @@ Query PROCESS to `:cd` to directory DIR."
(if (string-match "^[A-Za-z_]" (cdr state))
(format ":info %s" (cdr state))
(format ":info (%s)" (cdr state)))))
:complete (lambda (state response)
:complete (lambda (_state response)
(unless (or (string-match "^Top level" response)
(string-match "^<interactive>" response))
(haskell-mode-message-line response)))))))
Expand All @@ -603,7 +603,7 @@ Query PROCESS to `:cd` to directory DIR."
(if (string-match "^[A-Za-z_]" (cdr state))
(format ":type %s" (cdr state))
(format ":type (%s)" (cdr state)))))
:complete (lambda (state response)
:complete (lambda (_state response)
(unless (or (string-match "^Top level" response)
(string-match "^<interactive>" response))
(haskell-mode-message-line response)))))))
Expand Down Expand Up @@ -719,7 +719,7 @@ function `xref-find-definitions' after new table was generated."
(haskell-process-session (car state)))
"find . -name '*.hs' -print0 -or -name '*.lhs' -print0 -or -name '*.hsc' -print0"
"xargs -0 hasktags -e -x"))))
:complete (lambda (state response)
:complete (lambda (state _response)
(when (cdr state)
(let ((session-tags
(haskell-session-tags-filename
Expand Down Expand Up @@ -802,9 +802,9 @@ output. If CMD fails the buffer remains unchanged."
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" str)
(setq str (replace-match "" t t str)))
str))
(errout (lambda (fmt &rest args)
(let* ((warning-fill-prefix " "))
(display-warning cmd (apply 'format fmt args) :warning))))
(_errout (lambda (fmt &rest args)
(let* ((warning-fill-prefix " "))
(display-warning cmd (apply 'format fmt args) :warning))))
(filename (buffer-file-name (current-buffer)))
(cmd-prefix (replace-regexp-in-string " .*" "" cmd))
(tmp-file (make-temp-file cmd-prefix))
Expand All @@ -813,9 +813,9 @@ output. If CMD fails the buffer remains unchanged."
haskell-session)
(haskell-session-cabal-dir haskell-session)
default-directory))
(errcode (with-temp-file tmp-file
(call-process cmd filename
(list (current-buffer) err-file) nil)))
(_errcode (with-temp-file tmp-file
(call-process cmd filename
(list (current-buffer) err-file) nil)))
(stderr-output
(with-temp-buffer
(insert-file-contents err-file)
Expand Down
2 changes: 1 addition & 1 deletion haskell-compat.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-compat.el --- legacy/compatibility backports for haskell-mode
;;; haskell-compat.el --- legacy/compatibility backports for haskell-mode -*- lexical-binding: t -*-
;;
;; Filename: haskell-compat.el
;; Description: legacy/compatibility backports for haskell-mode
Expand Down
2 changes: 1 addition & 1 deletion haskell-compile.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-compile.el --- Haskell/GHC compilation sub-mode
;;; haskell-compile.el --- Haskell/GHC compilation sub-mode -*- lexical-binding: t -*-

;; Copyright (C) 2013 Herbert Valerio Riedel

Expand Down
5 changes: 2 additions & 3 deletions haskell-complete-module.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-complete-module.el --- A fast way to complete Haskell module names
;;; haskell-complete-module.el --- A fast way to complete Haskell module names -*- lexical-binding: t -*-

;; Copyright (c) 2014 Chris Done. All rights reserved.

Expand Down Expand Up @@ -35,8 +35,7 @@

(defun haskell-complete-module-read (prompt candidates)
"Interactively auto-complete from a list of candidates."
(let ((continue t)
(stack (list))
(let ((stack (list))
(pattern "")
(result nil))
(delete-dups candidates)
Expand Down
2 changes: 1 addition & 1 deletion haskell-completions.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-completions.el --- Haskell Completion package
;;; haskell-completions.el --- Haskell Completion package -*- lexical-binding: t -*-

;; Copyright © 2015 Athur Fayzrakhmanov. All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion haskell-customize.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-customize.el --- Customization settings
;;; haskell-customize.el --- Customization settings -*- lexical-binding: t -*-

;; Copyright (c) 2014 Chris Done. All rights reserved.

Expand Down
5 changes: 2 additions & 3 deletions haskell-debug.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-debug.el --- Debugging mode via GHCi
;;; haskell-debug.el --- Debugging mode via GHCi -*- lexical-binding: t -*-

;; Copyright (c) 2014 Chris Done. All rights reserved.

Expand Down Expand Up @@ -556,8 +556,7 @@ Stopped at /home/foo/project/src/x.hs:6:25-36
(cl-loop for span in history
do (let ((string (haskell-debug-get-span-string
(plist-get span :path)
(plist-get span :span)))
(index (plist-get span :index)))
(plist-get span :span))))
(insert (propertize (format "%4d" i)
'face 'haskell-debug-trace-number-face)
" "
Expand Down
2 changes: 1 addition & 1 deletion haskell-decl-scan.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-decl-scan.el --- Declaration scanning module for Haskell Mode
;;; haskell-decl-scan.el --- Declaration scanning module for Haskell Mode -*- lexical-binding: t -*-

;; Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1997-1998 Graeme E Moss
Expand Down
5 changes: 2 additions & 3 deletions haskell-doc.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-doc.el --- show function types in echo area -*- coding: utf-8 -*-
;;; haskell-doc.el --- show function types in echo area -*- coding: utf-8; lexical-binding: t -*-

;; Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1997 Hans-Wolfgang Loidl
Expand Down Expand Up @@ -1616,8 +1616,7 @@ the haskell-doc database."
(is-reserved (haskell-doc-is-of sym haskell-doc-reserved-ids))
(is-prelude (haskell-doc-is-of sym haskell-doc-prelude-types))
(is-strategy (haskell-doc-is-of sym haskell-doc-strategy-ids))
(is-user-defined (haskell-doc-is-of sym haskell-doc-user-defined-ids))
(is-prelude (haskell-doc-is-of sym haskell-doc-prelude-types)))
(is-user-defined (haskell-doc-is-of sym haskell-doc-user-defined-ids)))
(cond
;; if reserved id (i.e. Haskell keyword
((and haskell-doc-show-reserved
Expand Down
2 changes: 1 addition & 1 deletion haskell-font-lock.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-font-lock.el --- Font locking module for Haskell Mode
;;; haskell-font-lock.el --- Font locking module for Haskell Mode -*- lexical-binding: t -*-

;; Copyright 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Copyright 1997-1998 Graeme E Moss, and Tommy Thorn
Expand Down
8 changes: 4 additions & 4 deletions haskell-indent.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-indent.el --- "semi-intelligent" indentation module for Haskell Mode
;;; haskell-indent.el --- "semi-intelligent" indentation module for Haskell Mode -*- lexical-binding: t -*-

;; Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright 1997-1998 Guy Lapalme
Expand Down Expand Up @@ -440,7 +440,7 @@ Returns the location of the start of the comment, nil otherwise."

(defun haskell-indent-next-symbol-safe (end)
"Puts point to the next following symbol, or to end if there are no more symbols in the sexp."
(condition-case errlist (haskell-indent-next-symbol end)
(condition-case _errlist (haskell-indent-next-symbol end)
(error (goto-char end))))

(defun haskell-indent-separate-valdef (start end)
Expand Down Expand Up @@ -1302,7 +1302,7 @@ We stay in the cycle as long as the TAB key is pressed."
(if marker
(goto-char (marker-position marker)))))))

(defun haskell-indent-region (start end)
(defun haskell-indent-region (_start _end)
(error "Auto-reindentation of a region is not supported"))

;;; alignment functions
Expand Down Expand Up @@ -1440,7 +1440,7 @@ TYPE is either 'guard or 'rhs."
(if regstack
(haskell-indent-shift-columns maxcol regstack)))))))

(defun haskell-indent-align-guards-and-rhs (start end)
(defun haskell-indent-align-guards-and-rhs (_start _end)
"Align the guards and rhs of functions in the region, which must be active."
;; The `start' and `end' args are dummys right now: they're just there so
;; we can use the "r" interactive spec which properly signals an error.
Expand Down
11 changes: 4 additions & 7 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; haskell-indentation.el --- indentation module for Haskell Mode
;;; haskell-indentation.el --- indentation module for Haskell Mode -*- lexical-binding: t -*-

;; Copyright (C) 2013 Kristof Bastiaensen, Gergely Risko

Expand Down Expand Up @@ -203,8 +203,7 @@ NIL otherwise."

(defun haskell-indentation-reindent-to (col &optional move)
"Reindent current line to COL, move the point there if MOVE is non-NIL."
(let* ((cc (current-column))
(ci (haskell-indentation-current-indentation)))
(let* ((ci (haskell-indentation-current-indentation)))
(save-excursion
(move-to-column ci)
(if (<= ci col)
Expand Down Expand Up @@ -259,8 +258,7 @@ negative ARG. Handles bird style literate Haskell too."
(newline)
(unless (haskell-indentation-bird-outside-code-p)
(catch 'parse-error
(let* ((cc (current-column))
(ci (haskell-indentation-current-indentation))
(let* ((ci (haskell-indentation-current-indentation))
(indentations (haskell-indentation-find-indentations-safe)))
(when (haskell-indentation-bird-p)
(insert "> "))
Expand Down Expand Up @@ -349,8 +347,7 @@ indentation points to the right, we switch going to the left."
((and (eq last-command 'indent-for-tab-command)
(memq haskell-indentation-dyn-last-direction '(left right))
haskell-indentation-dyn-last-indentations)
(let* ((cc (current-column))
(ci (haskell-indentation-current-indentation)))
(let ((ci (haskell-indentation-current-indentation)))
(if (eq haskell-indentation-dyn-last-direction 'left)
(haskell-indentation-reindent-to
(haskell-indentation-previous-indentation
Expand Down
Loading