Skip to content

Commit

Permalink
Use let and lexical-binding instead of lexical-let
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Mar 6, 2020
1 parent 7a4f559 commit df91457
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions ctable.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; ctable.el --- Table component for Emacs Lisp
;;; ctable.el --- Table component for Emacs Lisp -*- lexical-binding: t; -*-

;; Copyright (C) 2011, 2012, 2013, 2014 SAKURAI Masashi

Expand Down Expand Up @@ -352,7 +352,7 @@ calculated from the window that shows BUF or the selected window.
The component object is stored at the buffer local variable
`ctbl:component'. CUSTOM-MAP is the additional keymap that is
added to default keymap `ctbl:table-mode-map'."
(lexical-let
(let
((buffer (or buf (get-buffer-create (format "*Table: %d*" (ctbl:uid)))))
(window (or (and buf (get-buffer-window buf)) (selected-window)))
dest)
Expand Down Expand Up @@ -382,7 +382,7 @@ space. This destination is employed to be embedded in the some
application buffer. Because this destination does not set up
any modes and key maps for the buffer, the application that uses
the ctable is responsible to manage the buffer and key maps."
(lexical-let
(let
((mark-begin mark-begin) (mark-end mark-end)
(window (or (get-buffer-window buf) (selected-window))))
(make-ctbl:dest
Expand All @@ -409,7 +409,7 @@ the ctable is responsible to manage the buffer and key maps."

(defun ctbl:dest-init-inline (width height)
"Create a text destination."
(lexical-let
(let
((buffer (get-buffer-create ctbl:dest-background-buffer))
(window (selected-window))
dest)
Expand Down Expand Up @@ -438,7 +438,7 @@ the ctable is responsible to manage the buffer and key maps."
"[internal] Put a selection overlay on CELL-ID. The selection overlay can be
put on some cells, calling this function many times. This
function does not manage the selections, just put the overlay."
(lexical-let (ols (row-id (car cell-id)) (col-id (cdr cell-id)))
(let (ols (row-id (car cell-id)) (col-id (cdr cell-id)))
(ctbl:dest-with-region dest
(ctbl:find-all-by-row-id
dest row-id
Expand Down Expand Up @@ -583,7 +583,7 @@ HOOK is a function that has no argument."
;; asynchronous model
((ctbl:async-model-p
(ctbl:model-data (ctbl:component-model component)))
(lexical-let ((cp component))
(let ((cp component))
(ctbl:async-state-on-update cp)
(ctbl:render-async-main
dest
Expand Down Expand Up @@ -877,7 +877,7 @@ bug), this function may return nil."

(defun ctbl:render-column-header-keymap (col-id)
"[internal] Generate action handler on the header columns. (for header-line-format)"
(lexical-let ((col-id col-id))
(let ((col-id col-id))
(let ((keymap (copy-keymap ctbl:column-header-keymap)))
(define-key keymap [header-line mouse-1]
(lambda ()
Expand Down Expand Up @@ -1041,7 +1041,7 @@ surplus width."
for cm in cmodels
for al = (ctbl:cmodel-align cm)
collect
(lexical-let ((cw cw))
(let ((cw cw))
(cond
((eq al 'left)
(lambda (s) (ctbl:format-left cw s)))
Expand Down Expand Up @@ -1428,7 +1428,7 @@ panel-end : end mark object for status panel
(defun ctbl:render-async-main (dest model param rows-setter)
"[internal] Rendering the table view for async data model.
This function assumes that the current buffer is the destination buffer."
(lexical-let*
(let*
((dest dest) (model model) (param param) (rows-setter rows-setter)
(amodel (ctbl:model-data model)) (buf (current-buffer))
(cmodels (ctbl:model-column-model model)))
Expand Down Expand Up @@ -1478,7 +1478,7 @@ This function assumes that the current buffer is the destination buffer."

(defun ctbl:render-async-continue (component)
"[internal] Rendering subsequent data asynchronously."
(lexical-let*
(let*
((cp component) (dest (ctbl:component-dest cp)) (buf (current-buffer))
(model (ctbl:cp-get-model cp))
(amodel (ctbl:model-data model))
Expand Down Expand Up @@ -1538,7 +1538,7 @@ to urge async data model to request next data chunk."
(defun ctbl:async-model-wrapper (rows &optional init-num more-num)
"This function wraps a list of row data in an asynchronous data
model so as to avoid Emacs freezing with a large number of rows."
(lexical-let ((rows rows) (rest-rows rows)
(let ((rows rows) (rest-rows rows)
(init-num (or init-num 100))
(more-num (or more-num 100)))
(make-ctbl:async-model
Expand Down Expand Up @@ -1690,24 +1690,24 @@ sides with the character PADDING."
(let*
((comparator
(lambda (ref)
(lexical-let
(let
((ref ref)
(f (or (ctbl:cmodel-sorter (nth ref cmodels))
'ctbl:sort-string-lessp)))
(lambda (i j)
(funcall f (nth ref i) (nth ref j))))))
(negative-comparator
(lambda (ref)
(lexical-let ((cp (funcall comparator ref)))
(let ((cp (funcall comparator ref)))
(lambda (i j) (- (funcall cp i j))))))
(to-bool
(lambda (f)
(lexical-let ((f f))
(let ((f f))
(lambda (i j)
(< (funcall f i j) 0)))))
(chain
(lambda (fs)
(lexical-let ((fs fs))
(let ((fs fs))
(lambda (i j)
(cl-loop for f in fs
for v = (funcall f i j)
Expand Down Expand Up @@ -1822,7 +1822,7 @@ KEYMAP is the keymap that is put to the text property `keymap'. If KEYMAP is nil
(let* ((dest (ctbl:dest-init-region (current-buffer) mark-begin mark-end width height))
(cp (ctbl:cp-new dest model param))
(after-update-func
(lexical-let ((keymap keymap) (cp cp))
(let ((keymap keymap) (cp cp))
(lambda ()
(ctbl:dest-with-region (ctbl:component-dest cp)
(let (buffer-read-only)
Expand Down

0 comments on commit df91457

Please sign in to comment.