Peter Szilagyi avatar Peter Szilagyi committed 1cc7d1a

Can't use lexical-let*; apparently buggy in Emacs 24:

Comments (0)

Files changed (1)

elisp/omake/omake-project-buffer.el

 
 (defun Omake.Project_buffer.to-line (i p)
   (assert (Omake.Project.is p))
-  ;; Use lexical-let so we can put the line in a closure
-  (lexical-let*
-      ((p p) ; NB. close on p
-       (id (Omake.Project.id p))
+  ;; Can't use lexical-let*; apparently buggy in Emacs 24:
+  ;;
+  ;; Debugger entered--Lisp error: (wrong-type-argument keymapp [bad-lexical-ref])
+  ;; define-key([bad-lexical-ref] "w" (lambda (&rest --cl-rest--) "Watch the project on the given line." (interactive) (apply (quote (closure ((--cl-watch-- . --watch--) (--cl-root-- . --root--) (--cl-id-- . --id--) (--cl-p-- . --p--) (p . [cl-struct-Omake\.Project [cl-struct-Omake\.Id "/mnt/local/sda1/pszilagyi/jane-elisp"] "/home/pszilagyi/local/jane-elisp/test" "~/local/jane-elisp" "jomake -j 12 .DEFAULT runtest" 1 [cl-struct-Omake\.Env nil nil nil nil nil] [cl-struct-Omake\.Env nil nil nil nil nil]]) (i . 0) t) (G459 G460 G461) (Omake\.Model\.toggle-watch (symbol-value G460)))) (quote --root--) (quote --id--) (quote --p--) --cl-rest--)))
+  ;; (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "w" (symbol-value --cl-watch--)))) (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "k" (symbol-value --cl-kill--)))) (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "d" (symbol-value --cl-kill--)))) (let ((--cl-_-- (define-key (symbol-value ...) "l" (symbol-value --cl-goto-error--)))) (let ((--cl-_-- (define-key ... "
+  ;; (let ((--cl-line-keymap-- (make-sparse-keymap))) (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "w" (symbol-value --cl-watch--)))) (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "k" (symbol-value --cl-kill--)))) (let ((--cl-_-- (define-key (symbol-value ...) "d" (symbol-value --cl-kill--)))) (let ((--cl-_-- (define-key ... "l" ...))) (let ((--cl-_-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-dired-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda ... ...))) (list (quote quote) --cl-goto-error--) (list (quote quote) --cl-kill--) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--))))) (let ((--cl-line-keymap-- (make-sparse-keymap))) (let ((--cl-_-- (define-key (symbol-value (quote --cl-line-keymap--)) "w" (symbol-value --cl-watch--)))) (let ((--cl-_-- (define-key (symbol-value ...) "k" (symbol-value --cl-kill--)))) (let ((--cl-_-- (define-key ... "d" ...))) (let ((--cl-_-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-goto-error-- (make-symbol "--goto-error--"))) (set --cl-goto-error-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda (G450 G451 G452 G453 G454) (Omake\.next-error nil ...)))) (list (quote quote) --cl-kill--) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-dired-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function ...)) (list (quote quote) --cl-goto-error--) (list (quote quote) --cl-kill--) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--))))) (let ((--cl-line-keymap-- (make-sparse-keymap))) (let ((--cl-_-- (define-key (symbol-value ...) "w" (symbol-value --cl-watch--)))) (let ((--cl-_-- (define-key ... "k" ...))) (let ((--cl-_-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-kill-- (make-symbol "--kill--"))) (set --cl-kill-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Kill the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda (G455 G456 G457 G458) (Omake\.kill-project ...)))) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-goto-error-- (make-symbol "--goto-error--"))) (set --cl-goto-error-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda ... ...))) (list (quote quote) --cl-kill--) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-dired-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list ... ...) (list ... --cl-goto-error--) (list ... --cl-kill--) (list ... --cl-watch--) (list ... --cl-root--) (list ... --cl-id--) (list ... --cl-p--) (quote --cl-rest--))))) (let ((--cl-line-keymap-- (make-sparse-keymap))) (let ((--cl-_-- (define-key ... "w" ...))) (let ((--cl-_-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-watch-- (make-symbol "--watch--"))) (set --cl-watch-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Watch the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda (G459 G460 G461) (Omake\.Model\.toggle-watch ...)))) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-kill-- (make-symbol "--kill--"))) (set --cl-kill-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Kill the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda ... ...))) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-goto-error-- (make-symbol "--goto-error--"))) (set --cl-goto-error-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function ...)) (list (quote quote) --cl-kill--) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-dired-- (list (quote lambda) (quote ...) (quote "Jump to the next error for the project on the given line.") (quote ...) (list ... ... ... ... ... ... ... ... ...)))) (let ((--cl-line-keymap-- (make-sparse-keymap))) (let ((--cl-_-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-root-- (make-symbol "--root--"))) (set --cl-root-- (Omake\.Project\.omakeroot-dir (symbol-value --cl-p--))) (let ((--cl-watch-- (make-symbol "--watch--"))) (set --cl-watch-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Watch the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function (lambda ... ...))) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-kill-- (make-symbol "--kill--"))) (set --cl-kill-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Kill the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function ...)) (list (quote quote) --cl-watch--) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-goto-error-- (make-symbol "--goto-error--"))) (set --cl-goto-error-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Jump to the next error for the project on the given line.") (quote (interactive)) (list (quote apply) (list ... ...) (list ... --cl-kill--) (list ... --cl-watch--) (list ... --cl-root--) (list ... --cl-id--) (list ... --cl-p--) (quote --cl-rest--)))) (let ((--cl-dired-- (list ... ... ... ... ...))) (let ((--cl-line-keymap-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-id-- (make-symbol "--id--"))) (set --cl-id-- (Omake\.Project\.id (symbol-value --cl-p--))) (let ((--cl-root-- (make-symbol "--root--"))) (set --cl-root-- (Omake\.Project\.omakeroot-dir (symbol-value --cl-p--))) (let ((--cl-watch-- (make-symbol "--watch--"))) (set --cl-watch-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Watch the project on the given line.") (quote (interactive)) (list (quote apply) (list (quote quote) (function ...)) (list (quote quote) --cl-root--) (list (quote quote) --cl-id--) (list (quote quote) --cl-p--) (quote --cl-rest--)))) (let ((--cl-kill-- (make-symbol "--kill--"))) (set --cl-kill-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Kill the project on the given line.") (quote (interactive)) (list (quote apply) (list ... ...) (list ... --cl-watch--) (list ... --cl-root--) (list ... --cl-id--) (list ... --cl-p--) (quote --cl-rest--)))) (let ((--cl-goto-error-- (make-symbol "--goto-error--"))) (set --cl-goto-error-- (list (quote lambda) (quote ...) (quote "Jump to the next error for the project on the given line.") (quote ...) (list ... ... ... ... ... ... ... ...))) (let ((--cl-dired-- ...)) (let (...) (let ... ...))))))))
+  ;; (let ((--cl-p-- (make-symbol "--p--"))) (setf (symbol-value --cl-p--) p) (let ((--cl-id-- (make-symbol "--id--"))) (set --cl-id-- (Omake\.Project\.id (symbol-value --cl-p--))) (let ((--cl-root-- (make-symbol "--root--"))) (set --cl-root-- (Omake\.Project\.omakeroot-dir (symbol-value --cl-p--))) (let ((--cl-watch-- (make-symbol "--watch--"))) (set --cl-watch-- (list (quote lambda) (quote (&rest --cl-rest--)) (quote "Watch the project on the given line.") (quote (interactive)) (list (quote apply) (list ... ...) (list ... --cl-root--) (list ... --cl-id--) (list ... --cl-p--) (quote --cl-rest--)))) (let ((--cl-kill-- (make-symbol "--kill--"))) (set --cl-kill-- (list (quote lambda) (quote ...) (quote "Kill the project on the given line.") (quote ...) (list ... ... ... ... ... ... ...))) (let ((--cl-goto-error-- ...)) (set --cl-goto-error-- (list ... ... ... ... ...)) (let (...) (let ... ...))))))))
+  ;; (lexical-let ((p p)) (lexical-let ((id (Omake\.Project\.id p))) (lexical-let ((root (Omake\.Project\.omakeroot-dir p))) (lexical-let ((watch (lambda nil "Watch the project on the given line." (interactive) (Omake\.Model\.toggle-watch id)))) (lexical-let ((kill (lambda nil "Kill the project on the given line." ... ...))) (lexical-let ((goto-error ...)) (lexical-let (...) (lexical-let ... ...))))))))
+  ;; (lexical-let* ((p p) (id (Omake\.Project\.id p)) (root (Omake\.Project\.omakeroot-dir p)) (watch (lambda nil "Watch the project on the given line." (interactive) (Omake\.Model\.toggle-watch id))) (kill (lambda nil "Kill the project on the given line." (interactive) (Omake\.kill-project id))) (goto-error (lambda nil "Jump to the next error for the project on the given line." (interactive) (Omake\.next-error nil id))) (dired (lambda nil "Jump to the next error for the project on the given line." (interactive) (Omake\.Project_buffer\.show-dired-buffer p))) (line-keymap (make-sparse-keymap)) (_ (define-key line-keymap "w" watch)) (_ (define-key line-keymap "k" kill)) (_ (define-key line-keymap "d" kill)) (_ (define-key line-keymap "l" goto-error)) (_ (define-key line-keymap (kbd "C-m") dired)) (fullroot (expand-file-name root)) (dir (Omake\.Project\.compilation-dir-relpath p)) (watched (if (Omake\.Model\.is-watching id) "yes" "no")) (num (Omake\.Project\.num-watchers p)) (str (format "[%d] %-8s %-11d %-25s %s\n" i watched num root dir))) (propertize str (quote keymap) line-keymap (quote index) i))
+  ;; Omake\.Project_buffer\.to-line(0 [cl-struct-Omake\.Project [cl-struct-Omake\.Id "/mnt/local/sda1/pszilagyi/jane-elisp"] "/home/pszilagyi/local/jane-elisp/test" "~/local/jane-elisp" "jomake -j 12 .DEFAULT runtest" 1 [cl-struct-Omake\.Env nil nil nil nil nil] [cl-struct-Omake\.Env nil nil nil nil nil]])
+  ;;
+  ;; Fortunately, in Emacs Lisp, a lambda expression is
+  ;; self-evaluating, i.e., functions are represented as their own
+  ;; representative S-exprs, so we can splice something together.
+  (let*
+      ((id (Omake.Project.id p))
        (root (Omake.Project.omakeroot-dir p))
        (watch
-        (lambda ()
-          "Watch the project on the given line."
-          (interactive)
-          (Omake.Model.toggle-watch id)))
+        `(lambda ()
+           "Watch the project on the given line."
+           (interactive)
+           (Omake.Model.toggle-watch ,id)))
        (kill
-        (lambda ()
-          "Kill the project on the given line."
-          (interactive)
-          (Omake.kill-project id)))
+        `(lambda ()
+           "Kill the project on the given line."
+           (interactive)
+           (Omake.kill-project ,id)))
        (goto-error
-        (lambda ()
-          "Jump to the next error for the project on the given line."
-          (interactive)
-          (Omake.next-error nil id)))
+        `(lambda ()
+           "Jump to the next error for the project on the given line."
+           (interactive)
+           (Omake.next-error nil ,id)))
        (dired
-        (lambda ()
-          "Jump to the next error for the project on the given line."
-          (interactive)
-          (Omake.Project_buffer.show-dired-buffer p)))
+        `(lambda ()
+           "Jump to the next error for the project on the given line."
+           (interactive)
+           (Omake.Project_buffer.show-dired-buffer ,p)))
        (line-keymap (make-sparse-keymap))
        (_ (define-key line-keymap "w" watch))
        (_ (define-key line-keymap "k" kill))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.