diff --git a/haskell-indentation.el b/haskell-indentation.el index 61929598d..296178ee7 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -210,7 +210,7 @@ negative ARG. Handles bird style literate Haskell too." (defun haskell-indentation-next-indentation (col indentations &optional nofail) "Find the leftmost indentation which is greater than COL. Indentations are taken from INDENTATIONS, which should be a -list. Return the last indentation if there are no bigger ones and +list. Return the last indentation if there are no bigger ones and NOFAIL is non-NIL." (when (null indentations) (error "haskell-indentation-next-indentation called with empty list")) @@ -219,7 +219,9 @@ NOFAIL is non-NIL." (car (last indentations))))) (defun haskell-indentation-previous-indentation (col indentations &optional nofail) - "Find the rightmost indentation which is less than COL." + "Find the rightmost indentation less than COL from INDENTATIONS. +When no indentations are less than COL, return the rightmost indentation +if NOFAIL is non-nil, or nil otherwise." (when (null indentations) (error "haskell-indentation-previous-indentation called with empty list")) (let ((rev (reverse indentations))) @@ -295,11 +297,11 @@ indentation points to the right, we switch going to the left." t)) (t nil))) -(defun haskell-indentation-indent-region (start end) +(defun haskell-indentation-indent-region (_start _end) "This function does nothing. It is better to do nothing to indent region in Haskell than to -break the semantics of indentation. This function is used for +break the semantics of indentation. This function is used for `indent-region-function' because the default is to call `indent-line-function' on every line from START to END and that also produces catastrophic results. diff --git a/haskell-interactive-mode.el b/haskell-interactive-mode.el index 102bfe1a8..757e6bec5 100644 --- a/haskell-interactive-mode.el +++ b/haskell-interactive-mode.el @@ -53,8 +53,8 @@ (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 -at the beginning of the line. This should prevent any + "Generate a regex for searching for any occurence of the prompt\ +at the beginning of the line. This should prevent any interference with prompts that look like haskell expressions." (concat "^" (regexp-quote haskell-interactive-prompt))) @@ -81,7 +81,7 @@ interference with prompts that look like haskell expressions." (define-key map (kbd "TAB") 'haskell-interactive-mode-tab) (define-key map (kbd "") 'haskell-interactive-mode-kill-whole-line) map) - "Keymap used in `haskell-interactive-mode'") + "Keymap used in `haskell-interactive-mode'.") (define-derived-mode haskell-interactive-mode fundamental-mode "Interactive-Haskell" "Interactive mode for Haskell. @@ -107,8 +107,8 @@ Key bindings: (defvar haskell-interactive-mode-result-end nil - "Mark used to figure out where the end of the current result - output is. Used to distinguish betwen user input.") + "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 "Records the buffer to which `haskell-interactive-switch-back' should jump. @@ -181,8 +181,7 @@ be nil.") (message "No previous buffer."))) (defun haskell-interactive-copy-to-prompt () - "Copy the current line to the prompt, overwriting the current -prompt." + "Copy the current line to the prompt, overwriting the current prompt." (interactive) (let ((l (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) @@ -206,7 +205,7 @@ prompt." (self-insert-command n)))) (defun haskell-interactive-at-prompt () - "If at prompt, returns start position of user-input, otherwise returns nil." + "If at prompt, return start position of user-input, otherwise return nil." (if (>= (point) haskell-interactive-mode-prompt-start) haskell-interactive-mode-prompt-start @@ -252,14 +251,13 @@ prompt." out))) (defun haskell-interactive-mode-multi-line (expr) - "If a multi-line expression has been entered, then reformat it to be: + "If a multi-line expression EXPR has been entered, then reformat it to be: :{ do the multi-liner expr -:} -" +:}" (if (not (string-match "\n" expr)) expr (let* ((i 0) @@ -277,7 +275,7 @@ do the "\n")))) (defun haskell-interactive-trim (line) - "Trim indentation off of lines in the REPL." + "Trim indentation off of LINE in the REPL." (if (and (string-match "^[ ]+" line) (> (length line) (length haskell-interactive-prompt))) @@ -412,12 +410,12 @@ SESSION, otherwise operate on the current buffer." 'rear-nonsticky t))))) (defun haskell-interactive-mode-goto-end-point () - "Go to the 'end' of the buffer (before the prompt.)" + "Go to the 'end' of the buffer (before the prompt)." (goto-char haskell-interactive-mode-prompt-start) (goto-char (line-beginning-position))) (defun haskell-interactive-mode-history-add (input) - "Add item to the history." + "Add INPUT to the history." (setq haskell-interactive-mode-history (cons "" (cons input @@ -552,7 +550,7 @@ FILE-NAME only." nil) (defun haskell-process-parse-error (string) - "Parse the line number from the error." + "Parse the line number from the error string STRING." (let ((span nil)) (cl-loop for regex in haskell-compilation-error-regexp-alist @@ -751,8 +749,9 @@ wrapped in compiler directive at the top of FILE." buffer. Maybe run M-x haskell-process-restart?"))) (defun haskell-interactive-mode-do-presentation (expr) - "Present the given expression. Requires the `present' package -to be installed. Will automatically import it qualified as Present." + "Present the given expression EXPR. +Requires the `present' package to be installed. +Will automatically import it qualified as Present." (let ((p (haskell-interactive-process))) ;; If Present.code isn't available, we probably need to run the ;; setup. @@ -797,7 +796,7 @@ to be installed. Will automatically import it qualified as Present." reply))) (defun haskell-presentation-present-slot (btn) - "The callback to evaluate the slot and present it in place of the button." + "The callback to evaluate the slot and present it in place of the button BTN." (let ((id (button-get btn 'presentation-id)) (hash (button-get btn 'hash)) (parent-rep (button-get btn 'parent-rep)) @@ -962,7 +961,7 @@ don't care when the thing completes as long as it's soonish." 'help-echo "Click to expand…") (defun haskell-interactive-mode-history-toggle (n) - "Toggle the history n items up or down." + "Toggle the history N items up or down." (unless (null haskell-interactive-mode-history) (setq haskell-interactive-mode-history-index (mod (+ haskell-interactive-mode-history-index n) @@ -1044,8 +1043,8 @@ This completion function is used in interactive REPL buffer itself." (list (- (point) rlen) (point) coll)))) (defun haskell-interactive-mode-trigger-compile-error (state response) - "Look for an compile error; if there is one, pop - that up in a buffer, similar to `debug-on-error'." + "Look for an compile error. +If there is one, pop that up in a buffer, similar to `debug-on-error'." (when (and haskell-interactive-types-for-show-ambiguous (string-match "^\n:[-0-9]+:[-0-9]+:" response) (not (string-match "^\n:[-0-9]+:[-0-9]+:[\n ]+Warning:" response))) @@ -1089,7 +1088,7 @@ This completion function is used in interactive REPL buffer itself." 'rear-nonsticky t)))))) (defun haskell-interactive-mode-splices-buffer (session) - "Get the splices buffer for the current session." + "Get the splices buffer for the current SESSION." (get-buffer-create (haskell-interactive-mode-splices-buffer-name session))) (defun haskell-interactive-mode-splices-buffer-name (session) diff --git a/haskell.el b/haskell.el index 84a49dc31..2b1c809bd 100644 --- a/haskell.el +++ b/haskell.el @@ -74,8 +74,9 @@ (make-obsolete 'haskell-process-completions-at-point 'haskell-completions-sync-repl-completion-at-point "June 19, 2015") + (defun haskell-process-completions-at-point () - "A completion-at-point function using the current haskell process." + "A `completion-at-point' function using the current haskell process." (when (haskell-session-maybe) (let ((process (haskell-process)) symbol-bounds) @@ -461,9 +462,9 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'." (list "build --ghc-options=-fforce-recomp")))))) (defun haskell-process-file-loadish (command reload-p module-buffer) - "Run a loading-ish COMMAND that wants to pick up type errors -and things like that. RELOAD-P indicates whether the notification -should say 'reloaded' or 'loaded'. MODULE-BUFFER may be used + "Run a loading-ish COMMAND that wants to pick up type errors\ +and things like that. RELOAD-P indicates whether the notification +should say 'reloaded' or 'loaded'. MODULE-BUFFER may be used for various things, but is optional." (let ((session (haskell-session))) (haskell-session-current-dir session)