Skip to content

Commit 1d861d3

Browse files
committed
globally: eliminate or mark unused bindings; convert one to dynamic
1 parent 647210b commit 1d861d3

20 files changed

+82
-97
lines changed

haskell-cabal.el

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ resultung buffer-content"
459459
(,beg (plist-get ,section :beginning))
460460
(,end (plist-get ,section :end))
461461
(,start-col (plist-get ,section :data-start-column))
462-
(,section-data (buffer-substring ,beg ,end))
463-
(section-name (plist-get ,section :name )))
462+
(,section-data (buffer-substring ,beg ,end)))
464463
(save-excursion
465464
(prog1
466465
(with-temp-buffer
@@ -534,8 +533,7 @@ resultung buffer-content"
534533
"Strip indentation from each line, execute FORMS and reinstate indentation
535534
so that the indentation of the FIRST LINE matches"
536535
(let ((old-l1-indent (make-symbol "new-l1-indent"))
537-
(new-l1-indent (make-symbol "old-l1-indent"))
538-
(res nil))
536+
(new-l1-indent (make-symbol "old-l1-indent")))
539537
`(let ( (,old-l1-indent (save-excursion
540538
(goto-char (point-min))
541539
(current-indentation))))
@@ -672,9 +670,9 @@ resultung buffer-content"
672670
(let ((downcase-name (downcase name)))
673671
(haskell-cabal-find-subsection-by
674672
section
675-
'(lambda (subsection)
673+
`(lambda (subsection)
676674
(string= (downcase (haskell-cabal-section-name subsection))
677-
downcase-name)))))
675+
,downcase-name)))))
678676

679677
(defun haskell-cabal-goto-subsection (name)
680678
(let ((subsection (haskell-cabal-find-subsection (haskell-cabal-section) name)))
@@ -807,7 +805,6 @@ Source names from main-is and c-sources sections are left untouched
807805
(if (null candidates)
808806
(let* ((src-dir (haskell-cabal-join-paths base-dir (or (car src-dirs) "")))
809807
(newfile (haskell-cabal-join-paths src-dir filename))
810-
(subdir (file-name-directory newfile))
811808
(do-create-p (y-or-n-p (format "Create file %s ?" newfile))))
812809
(when do-create-p
813810
(find-file-other-window newfile )))

haskell-checkers.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@
128128
(when (re-search-forward new-old-code eline t)
129129
(replace-match new-code nil t)))))))
130130

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

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

haskell-commands.el

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ should be inserted."
343343
expr))))))
344344

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

515515
;;;###autoload
516-
(defun haskell-process-cd (&optional not-interactive)
516+
(defun haskell-process-cd (&optional _not-interactive)
517517
;; FIXME optional arg is not used
518518
"Change directory."
519519
(interactive)
@@ -585,7 +585,7 @@ Query PROCESS to `:cd` to directory DIR."
585585
(if (string-match "^[A-Za-z_]" (cdr state))
586586
(format ":info %s" (cdr state))
587587
(format ":info (%s)" (cdr state)))))
588-
:complete (lambda (state response)
588+
:complete (lambda (_state response)
589589
(unless (or (string-match "^Top level" response)
590590
(string-match "^<interactive>" response))
591591
(haskell-mode-message-line response)))))))
@@ -603,7 +603,7 @@ Query PROCESS to `:cd` to directory DIR."
603603
(if (string-match "^[A-Za-z_]" (cdr state))
604604
(format ":type %s" (cdr state))
605605
(format ":type (%s)" (cdr state)))))
606-
:complete (lambda (state response)
606+
:complete (lambda (_state response)
607607
(unless (or (string-match "^Top level" response)
608608
(string-match "^<interactive>" response))
609609
(haskell-mode-message-line response)))))))
@@ -719,7 +719,7 @@ function `xref-find-definitions' after new table was generated."
719719
(haskell-process-session (car state)))
720720
"find . -name '*.hs' -print0 -or -name '*.lhs' -print0 -or -name '*.hsc' -print0"
721721
"xargs -0 hasktags -e -x"))))
722-
:complete (lambda (state response)
722+
:complete (lambda (state _response)
723723
(when (cdr state)
724724
(let ((session-tags
725725
(haskell-session-tags-filename
@@ -802,9 +802,9 @@ output. If CMD fails the buffer remains unchanged."
802802
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" str)
803803
(setq str (replace-match "" t t str)))
804804
str))
805-
(errout (lambda (fmt &rest args)
806-
(let* ((warning-fill-prefix " "))
807-
(display-warning cmd (apply 'format fmt args) :warning))))
805+
(_errout (lambda (fmt &rest args)
806+
(let* ((warning-fill-prefix " "))
807+
(display-warning cmd (apply 'format fmt args) :warning))))
808808
(filename (buffer-file-name (current-buffer)))
809809
(cmd-prefix (replace-regexp-in-string " .*" "" cmd))
810810
(tmp-file (make-temp-file cmd-prefix))
@@ -813,9 +813,9 @@ output. If CMD fails the buffer remains unchanged."
813813
haskell-session)
814814
(haskell-session-cabal-dir haskell-session)
815815
default-directory))
816-
(errcode (with-temp-file tmp-file
817-
(call-process cmd filename
818-
(list (current-buffer) err-file) nil)))
816+
(_errcode (with-temp-file tmp-file
817+
(call-process cmd filename
818+
(list (current-buffer) err-file) nil)))
819819
(stderr-output
820820
(with-temp-buffer
821821
(insert-file-contents err-file)

haskell-complete-module.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535

3636
(defun haskell-complete-module-read (prompt candidates)
3737
"Interactively auto-complete from a list of candidates."
38-
(let ((continue t)
39-
(stack (list))
38+
(let ((stack (list))
4039
(pattern "")
4140
(result nil))
4241
(delete-dups candidates)

haskell-debug.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,7 @@ Stopped at /home/foo/project/src/x.hs:6:25-36
556556
(cl-loop for span in history
557557
do (let ((string (haskell-debug-get-span-string
558558
(plist-get span :path)
559-
(plist-get span :span)))
560-
(index (plist-get span :index)))
559+
(plist-get span :span))))
561560
(insert (propertize (format "%4d" i)
562561
'face 'haskell-debug-trace-number-face)
563562
" "

haskell-doc.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,7 @@ the haskell-doc database."
16161616
(is-reserved (haskell-doc-is-of sym haskell-doc-reserved-ids))
16171617
(is-prelude (haskell-doc-is-of sym haskell-doc-prelude-types))
16181618
(is-strategy (haskell-doc-is-of sym haskell-doc-strategy-ids))
1619-
(is-user-defined (haskell-doc-is-of sym haskell-doc-user-defined-ids))
1620-
(is-prelude (haskell-doc-is-of sym haskell-doc-prelude-types)))
1619+
(is-user-defined (haskell-doc-is-of sym haskell-doc-user-defined-ids)))
16211620
(cond
16221621
;; if reserved id (i.e. Haskell keyword
16231622
((and haskell-doc-show-reserved

haskell-indent.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Returns the location of the start of the comment, nil otherwise."
440440

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

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

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

13081308
;;; alignment functions
@@ -1440,7 +1440,7 @@ TYPE is either 'guard or 'rhs."
14401440
(if regstack
14411441
(haskell-indent-shift-columns maxcol regstack)))))))
14421442

1443-
(defun haskell-indent-align-guards-and-rhs (start end)
1443+
(defun haskell-indent-align-guards-and-rhs (_start _end)
14441444
"Align the guards and rhs of functions in the region, which must be active."
14451445
;; The `start' and `end' args are dummys right now: they're just there so
14461446
;; we can use the "r" interactive spec which properly signals an error.

haskell-indentation.el

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ NIL otherwise."
203203

204204
(defun haskell-indentation-reindent-to (col &optional move)
205205
"Reindent current line to COL, move the point there if MOVE is non-NIL."
206-
(let* ((cc (current-column))
207-
(ci (haskell-indentation-current-indentation)))
206+
(let* ((ci (haskell-indentation-current-indentation)))
208207
(save-excursion
209208
(move-to-column ci)
210209
(if (<= ci col)
@@ -259,8 +258,7 @@ negative ARG. Handles bird style literate Haskell too."
259258
(newline)
260259
(unless (haskell-indentation-bird-outside-code-p)
261260
(catch 'parse-error
262-
(let* ((cc (current-column))
263-
(ci (haskell-indentation-current-indentation))
261+
(let* ((ci (haskell-indentation-current-indentation))
264262
(indentations (haskell-indentation-find-indentations-safe)))
265263
(when (haskell-indentation-bird-p)
266264
(insert "> "))
@@ -349,8 +347,7 @@ indentation points to the right, we switch going to the left."
349347
((and (eq last-command 'indent-for-tab-command)
350348
(memq haskell-indentation-dyn-last-direction '(left right))
351349
haskell-indentation-dyn-last-indentations)
352-
(let* ((cc (current-column))
353-
(ci (haskell-indentation-current-indentation)))
350+
(let ((ci (haskell-indentation-current-indentation)))
354351
(if (eq haskell-indentation-dyn-last-direction 'left)
355352
(haskell-indentation-reindent-to
356353
(haskell-indentation-previous-indentation

haskell-interactive-mode.el

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ be nil.")
205205

206206
;; (define-key haskell-error-mode-map (kbd "q") 'quit-window)
207207

208-
(defun haskell-interactive-mode-handle-h (&optional bound)
208+
(defun haskell-interactive-mode-handle-h ()
209209
"Handle ^H in output."
210210
(let ((bound (point-min))
211211
(inhibit-read-only t))
@@ -251,9 +251,7 @@ do the
251251
expr
252252
(let* ((i 0)
253253
(lines (split-string expr "\n"))
254-
(len (length lines))
255-
(indent (make-string (length haskell-interactive-prompt)
256-
? )))
254+
(len (length lines)))
257255
(mapconcat 'identity
258256
(cl-loop for line in lines
259257
collect (cond ((= i 0)
@@ -329,15 +327,14 @@ SESSION, otherwise operate on the current buffer.
329327
"Insert the result of an eval as plain text."
330328
(with-current-buffer (haskell-session-interactive-buffer session)
331329
(goto-char (point-max))
332-
(let ((start (point)))
333-
(insert (ansi-color-apply
334-
(propertize text
335-
'font-lock-face 'haskell-interactive-face-result
336-
'rear-nonsticky t
337-
'read-only t
338-
'prompt t
339-
'result t)))
340-
(haskell-interactive-mode-handle-h start))
330+
(insert (ansi-color-apply
331+
(propertize text
332+
'font-lock-face 'haskell-interactive-face-result
333+
'rear-nonsticky t
334+
'read-only t
335+
'prompt t
336+
'result t)))
337+
(haskell-interactive-mode-handle-h)
341338
(let ((marker (set (make-local-variable 'haskell-interactive-mode-result-end)
342339
(make-marker))))
343340
(set-marker marker
@@ -571,8 +568,7 @@ FILE-NAME only."
571568

572569
(defun haskell-process-suggest-remove-import (session file import line)
573570
"Suggest removing or commenting out IMPORT on LINE."
574-
(let ((continue t)
575-
(first t))
571+
(let ((first t))
576572
(cl-case (read-event
577573
(propertize (format "%sThe import line `%s' is redundant. Remove? (y, n, c: comment out) "
578574
(if (not first)
@@ -812,7 +808,6 @@ FILE-NAME only."
812808
"Insert the presentation, hooking up buttons for each slot."
813809
(let* ((rep (cadr (assoc 'rep presentation)))
814810
(text (cadr (assoc 'text presentation)))
815-
(type (cadr (assoc 'type presentation)))
816811
(slots (cadr (assoc 'slots presentation)))
817812
(nullary (null slots)))
818813
(cond
@@ -1005,7 +1000,6 @@ don't care when the thing completes as long as it's soonish."
10051000
"Offer completions for partial expression between prompt and point"
10061001
(when (haskell-interactive-at-prompt)
10071002
(let* ((process (haskell-interactive-process))
1008-
(session (haskell-interactive-session))
10091003
(inp (haskell-interactive-mode-input-partial)))
10101004
(if (string= inp (car-safe haskell-interactive-mode-completion-cache))
10111005
(cdr haskell-interactive-mode-completion-cache)

haskell-menu.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Letters do not insert themselves; instead, they are commands."
6464
(define-key haskell-menu-mode-map (kbd "p") 'previous-line)
6565
(define-key haskell-menu-mode-map (kbd "RET") 'haskell-menu-mode-ret)
6666

67-
(defun haskell-menu-revert-function (arg1 arg2)
67+
(defun haskell-menu-revert-function (_arg1 _arg2)
6868
"Function to refresh the display."
6969
(let ((buffer-read-only nil)
7070
(orig-line (line-number-at-pos))

0 commit comments

Comments
 (0)