Skip to content

Commit c51cdb2

Browse files
authored
Merge pull request #58 from lassik/master
Avoid compiler warnings by using cl- versions of Common Lisp functions
2 parents 565104b + 459f47e commit c51cdb2

File tree

3 files changed

+199
-189
lines changed

3 files changed

+199
-189
lines changed

dime-note-tree.el

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ COLLAPSED-P says whether the tree is initially collapsed."
7575
"Make a note tree from a list of NOTES."
7676
(let* ((alist (dime-alistify notes #'dime-note.severity #'eq))
7777
(collapsed-p (dime-length> alist 1)))
78-
(loop for (severity . notes) in alist
79-
collect (dime-note-tree--for-severity severity notes
80-
collapsed-p))))
78+
(cl-loop for (severity . notes) in alist
79+
collect (dime-note-tree--for-severity severity notes
80+
collapsed-p))))
8181

8282
(defvar dime-note-tree-mode-map (make-sparse-keymap)
8383
"Keymap for Dime note tree mode.")
@@ -152,14 +152,14 @@ This command is meant to be bound to a mouse EVENT."
152152

153153
(defun dime-note-tree--insert-list (list prefix)
154154
"Insert LIST of note trees using PREFIX for each."
155-
(loop for (elt . rest) on list
156-
do (cond (rest
157-
(insert prefix " |")
158-
(dime-note-tree--insert elt (concat prefix " |"))
159-
(insert "\n"))
160-
(t
161-
(insert prefix " `")
162-
(dime-note-tree--insert elt (concat prefix " "))))))
155+
(cl-loop for (elt . rest) on list
156+
do (cond (rest
157+
(insert prefix " |")
158+
(dime-note-tree--insert elt (concat prefix " |"))
159+
(insert "\n"))
160+
(t
161+
(insert prefix " `")
162+
(dime-note-tree--insert elt (concat prefix " "))))))
163163

164164
(defun dime-note-tree--indent-item (start end prefix)
165165
"Insert PREFIX at the beginning of each line except the first.

dime-repl.el

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ If NOPROMPT is non-nil, omit prompt."
204204

205205
(defun dime-repl-output-filter (process string)
206206
(with-current-buffer (process-buffer process)
207-
(when (and (plusp (length string))
207+
(when (and (cl-plusp (length string))
208208
(eq (process-status dime-buffer-connection) 'open))
209209
(dime-write-string string))))
210210

@@ -669,7 +669,7 @@ If NEWLINE is true then add a newline at the end of the input."
669669
(add-text-properties dime-repl-input-start-mark
670670
(point)
671671
`(dime-repl-old-input
672-
,(incf dime-repl-old-input-counter))))
672+
,(cl-incf dime-repl-old-input-counter))))
673673
(let ((overlay (make-overlay dime-repl-input-start-mark end)))
674674
;; These properties are on an overlay so that they won't be taken
675675
;; by kill/yank.
@@ -686,7 +686,8 @@ If NEWLINE is true then add a newline at the end of the input."
686686
If replace is non-nil the current input is replaced with the old
687687
input; otherwise the new input is appended. The old input has the
688688
text property `dime-repl-old-input'."
689-
(multiple-value-bind (beg end) (dime-property-bounds 'dime-repl-old-input)
689+
(cl-multiple-value-bind (beg end)
690+
(dime-property-bounds 'dime-repl-old-input)
690691
(let ((old-input (buffer-substring beg end)) ;;preserve
691692
;;properties, they will be removed later
692693
(offset (- (point) beg)))
@@ -785,7 +786,7 @@ earlier in the buffer."
785786
(setf (dime-dylan-project-prompt-string) prompt-string)
786787
(setf dime-buffer-project name)
787788
(dime-repl-insert-prompt)
788-
(when (plusp previous-point)
789+
(when (cl-plusp previous-point)
789790
(goto-char (+ previous-point dime-repl-input-start-mark)))))))
790791

791792
;;;;; History
@@ -890,13 +891,13 @@ If EXCLUDE-STRING is specified then it's excluded from the search."
890891
(backward 1)))
891892
(history dime-repl-input-history)
892893
(len (length history)))
893-
(loop for pos = (+ start-pos step) then (+ pos step)
894-
if (< pos 0) return -1
895-
if (<= len pos) return len
896-
for history-item = (nth pos history)
897-
if (and (string-match regexp history-item)
898-
(not (equal history-item exclude-string)))
899-
return pos)))
894+
(cl-loop for pos = (+ start-pos step) then (+ pos step)
895+
if (< pos 0) return -1
896+
if (<= len pos) return len
897+
for history-item = (nth pos history)
898+
if (and (string-match regexp history-item)
899+
(not (equal history-item exclude-string)))
900+
return pos)))
900901

901902
(defun dime-repl-previous-input ()
902903
"Cycle backwards through input history.
@@ -939,7 +940,7 @@ See `dime-repl-previous-input'."
939940
(cond ((dime-repl-history-search-in-progress-p)
940941
dime-repl-history-pattern)
941942
(use-current-input
942-
(assert (<= dime-repl-input-start-mark (point)))
943+
(cl-assert (<= dime-repl-input-start-mark (point)))
943944
(let ((str (dime-repl-current-input t)))
944945
(cond ((string-match "^[ \t\n]*$" str) nil)
945946
(t (concat "^" (regexp-quote str))))))
@@ -1137,8 +1138,8 @@ The handler will use qeuery to ask the use if the error should be ingored."
11371138
(call-interactively handler))))))
11381139

11391140
(defun dime-repl-list-all-shortcuts ()
1140-
(loop for shortcut in dime-repl-shortcut-table
1141-
append (dime-repl-shortcut.names shortcut)))
1141+
(cl-loop for shortcut in dime-repl-shortcut-table
1142+
append (dime-repl-shortcut.names shortcut)))
11421143

11431144
(defun dime-repl-lookup-shortcut (name)
11441145
(cl-find-if (lambda (s) (member name (dime-repl-shortcut.names s)))
@@ -1157,7 +1158,7 @@ of the shortcut \(`:handler'\), and a help text \(`:one-liner'\)."
11571158
,(when edylan-name
11581159
`(defun ,edylan-name ()
11591160
(interactive)
1160-
(call-interactively ,(second (assoc :handler options)))))
1161+
(call-interactively ,(cl-second (assoc :handler options)))))
11611162
(let ((new-shortcut (make-dime-repl-shortcut
11621163
:symbol ',edylan-name
11631164
:names (list ,@names)
@@ -1459,7 +1460,7 @@ expansion will be added to the REPL's history.)"
14591460
(dime-write-string output target)
14601461
t)
14611462
((:read-string thread tag)
1462-
(assert thread)
1463+
(cl-assert thread)
14631464
(dime-repl-read-string thread tag)
14641465
t)
14651466
((:read-aborted thread tag)

0 commit comments

Comments
 (0)