Skip to content

Commit 446b95a

Browse files
committed
globally: eliminate or mark unused bindings; convert one to dynamic
1 parent 9cfcbd9 commit 446b95a

20 files changed

+81
-96
lines changed

haskell-cabal.el

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ resultung buffer-content"
460460
(,beg (plist-get ,section :beginning))
461461
(,end (plist-get ,section :end))
462462
(,start-col (plist-get ,section :data-start-column))
463-
(,section-data (buffer-substring ,beg ,end))
464-
(section-name (plist-get ,section :name )))
463+
(,section-data (buffer-substring ,beg ,end)))
465464
(save-excursion
466465
(prog1
467466
(with-temp-buffer
@@ -535,8 +534,7 @@ resultung buffer-content"
535534
"Strip indentation from each line, execute FORMS and reinstate indentation
536535
so that the indentation of the FIRST LINE matches"
537536
(let ((old-l1-indent (make-symbol "new-l1-indent"))
538-
(new-l1-indent (make-symbol "old-l1-indent"))
539-
(res nil))
537+
(new-l1-indent (make-symbol "old-l1-indent")))
540538
`(let ( (,old-l1-indent (save-excursion
541539
(goto-char (point-min))
542540
(current-indentation))))
@@ -673,9 +671,9 @@ resultung buffer-content"
673671
(let ((downcase-name (downcase name)))
674672
(haskell-cabal-find-subsection-by
675673
section
676-
'(lambda (subsection)
674+
`(lambda (subsection)
677675
(string= (downcase (haskell-cabal-section-name subsection))
678-
downcase-name)))))
676+
,downcase-name)))))
679677

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

haskell-checkers.el

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

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

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

haskell-commands.el

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

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

516516
;;;###autoload
517-
(defun haskell-process-cd (&optional not-interactive)
517+
(defun haskell-process-cd (&optional _not-interactive)
518518
;; FIXME optional arg is not used
519519
"Change directory."
520520
(interactive)
@@ -586,7 +586,7 @@ Query PROCESS to `:cd` to directory DIR."
586586
(if (string-match "^[A-Za-z_]" (cdr state))
587587
(format ":info %s" (cdr state))
588588
(format ":info (%s)" (cdr state)))))
589-
:complete (lambda (state response)
589+
:complete (lambda (_state response)
590590
(unless (or (string-match "^Top level" response)
591591
(string-match "^<interactive>" response))
592592
(haskell-mode-message-line response)))))))
@@ -604,7 +604,7 @@ Query PROCESS to `:cd` to directory DIR."
604604
(if (string-match "^[A-Za-z_]" (cdr state))
605605
(format ":type %s" (cdr state))
606606
(format ":type (%s)" (cdr state)))))
607-
:complete (lambda (state response)
607+
:complete (lambda (_state response)
608608
(unless (or (string-match "^Top level" response)
609609
(string-match "^<interactive>" response))
610610
(haskell-mode-message-line response)))))))
@@ -720,7 +720,7 @@ function `xref-find-definitions' after new table was generated."
720720
(haskell-process-session (car state)))
721721
"find . -name '*.hs' -print0 -or -name '*.lhs' -print0 -or -name '*.hsc' -print0"
722722
"xargs -0 hasktags -e -x"))))
723-
:complete (lambda (state response)
723+
:complete (lambda (state _response)
724724
(when (cdr state)
725725
(let ((session-tags
726726
(haskell-session-tags-filename
@@ -803,9 +803,9 @@ output. If CMD fails the buffer remains unchanged."
803803
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" str)
804804
(setq str (replace-match "" t t str)))
805805
str))
806-
(errout (lambda (fmt &rest args)
807-
(let* ((warning-fill-prefix " "))
808-
(display-warning cmd (apply 'format fmt args) :warning))))
806+
(_errout (lambda (fmt &rest args)
807+
(let* ((warning-fill-prefix " "))
808+
(display-warning cmd (apply 'format fmt args) :warning))))
809809
(filename (buffer-file-name (current-buffer)))
810810
(cmd-prefix (replace-regexp-in-string " .*" "" cmd))
811811
(tmp-file (make-temp-file cmd-prefix))
@@ -814,9 +814,9 @@ output. If CMD fails the buffer remains unchanged."
814814
haskell-session)
815815
(haskell-session-cabal-dir haskell-session)
816816
default-directory))
817-
(errcode (with-temp-file tmp-file
818-
(call-process cmd filename
819-
(list (current-buffer) err-file) nil)))
817+
(_errcode (with-temp-file tmp-file
818+
(call-process cmd filename
819+
(list (current-buffer) err-file) nil)))
820820
(stderr-output
821821
(with-temp-buffer
822822
(insert-file-contents err-file)

haskell-complete-module.el

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

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

haskell-debug.el

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

haskell-doc.el

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

haskell-indent.el

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

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

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

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

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

1444-
(defun haskell-indent-align-guards-and-rhs (start end)
1444+
(defun haskell-indent-align-guards-and-rhs (_start _end)
14451445
"Align the guards and rhs of functions in the region, which must be active."
14461446
;; The `start' and `end' args are dummys right now: they're just there so
14471447
;; 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
@@ -204,8 +204,7 @@ NIL otherwise."
204204

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

haskell-interactive-mode.el

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

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

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

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

haskell-menu.el

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

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

0 commit comments

Comments
 (0)