A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/emacs-eask/cli/commit/c0bf56ccc0c47846cd314067fde6ee4eeedee5aa below:

Further improve indent-lint · emacs-eask/cli@c0bf56c · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+25

-9

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+25

-9

lines changed Original file line number Diff line number Diff line change

@@ -27,25 +27,41 @@

27 27

;;

28 28

;;; Core

29 29 30 -

(defun eask--undo-lines (undo-list)

31 -

"Return list of lines changed in UNDO-LIST."

32 -

(let ((lines))

30 +

(defun eask--undo-pos (entry)

31 +

"Return the undo pos from ENTRY."

32 +

(cl-typecase (car entry)

33 +

(number (car entry))

34 +

(string (abs (cdr entry)))))

35 + 36 +

(defun eask--undo-infos (undo-list)

37 +

"Return list of infos in UNDO-LIST."

38 +

(let ((infos))

33 39

(dolist (elm undo-list)

34 -

(when (and (consp elm) (numberp (cdr elm)))

35 -

(push (line-number-at-pos (abs (cdr elm))) lines)))

36 -

(reverse lines)))

40 +

(when-let* ((pos (eask--undo-pos elm))

41 +

(line (line-number-at-pos pos))

42 +

(expected (progn (eask--goto-line line)

43 +

(current-indentation))))

44 +

(push (list line expected) infos)))

45 +

infos))

37 46 38 47

(defun eask--indent-lint-file (file)

39 48

"Lint indent for FILE."

40 49

(eask-msg "")

41 50

(eask-msg "`%s` with indent-lint" (ansi-green (eask-root-del file)))

42 51

(find-file file)

43 -

(let ((tick (buffer-modified-tick)))

52 +

(let ((tick (buffer-modified-tick))

53 +

(bs (buffer-string)))

54 +

(eask-with-temp-buffer (insert bs))

44 55

(eask--silent (indent-region (point-min) (point-max)))

45 56

(if (/= tick (buffer-modified-tick))

46 57

;; Indentation changed: warn for each line.

47 -

(dolist (line (eask--undo-lines buffer-undo-list))

48 -

(eask-report "%s:%s: mismatch indentation" (buffer-name) line))

58 +

(dolist (info (eask--undo-infos buffer-undo-list))

59 +

(let* ((line (nth 0 info))

60 +

(column (nth 1 info))

61 +

(current (eask-with-buffer

62 +

(eask--goto-line line) (current-indentation))))

63 +

(eask-report "%s:%s: Expected indentation is %s but found %s"

64 +

(buffer-name) line column current)))

49 65

(eask-log "No mismatch indentation found"))))

50 66 51 67

(eask-start

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4