jdtsmith / consult-jump-project Goto Github PK
View Code? Open in Web Editor NEWQuickly jump between projects, their files and buffers with consult
License: GNU General Public License v3.0
Quickly jump between projects, their files and buffers with consult
License: GNU General Public License v3.0
I'm trying out consult-jump-project
and it seems to be unhappy that I never used projects before, or something:
Debugger entered--Lisp error: (wrong-number-of-arguments #<subr max> 0)
max()
apply(max nil)
seq-max(nil)
consult-jump-project--projects()
#f(compiled-function (src) #<bytecode -0x3752f96fb4caa3a>)((:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects))
mapc(#f(compiled-function (src) #<bytecode -0x3752f96fb4caa3a>) [(:hidden nil :narrow 98 :name "Project Buffer" :narrow (112 . "Project") :hidden t :category buffer :face consult-buffer :history buffer-name-history :state consult--buffer-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :items #f(compiled-function () #<bytecode -0x818575f007b97a7>)) (:hidden nil :narrow 102 :name "Project File" :narrow (112 . "Project") :hidden t :category file :face consult-file :history file-name-history :state consult--file-state :new #f(compiled-function (file) #<bytecode 0x5c04d4921a53b7c>) :enabled #f(compiled-function () #<bytecode 0x1fe1275a6801>) :items #f(compiled-function () #<bytecode 0x17fbb5053212b2b>)) (:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects)])
seq-do(#f(compiled-function (src) #<bytecode -0x3752f96fb4caa3a>) [(:hidden nil :narrow 98 :name "Project Buffer" :narrow (112 . "Project") :hidden t :category buffer :face consult-buffer :history buffer-name-history :state consult--buffer-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :items #f(compiled-function () #<bytecode -0x818575f007b97a7>)) (:hidden nil :narrow 102 :name "Project File" :narrow (112 . "Project") :hidden t :category file :face consult-file :history file-name-history :state consult--file-state :new #f(compiled-function (file) #<bytecode 0x5c04d4921a53b7c>) :enabled #f(compiled-function () #<bytecode 0x1fe1275a6801>) :items #f(compiled-function () #<bytecode 0x17fbb5053212b2b>)) (:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects)])
consult--multi-candidates([(:hidden nil :narrow 98 :name "Project Buffer" :narrow (112 . "Project") :hidden t :category buffer :face consult-buffer :history buffer-name-history :state consult--buffer-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :items #f(compiled-function () #<bytecode -0x818575f007b97a7>)) (:hidden nil :narrow 102 :name "Project File" :narrow (112 . "Project") :hidden t :category file :face consult-file :history file-name-history :state consult--file-state :new #f(compiled-function (file) #<bytecode 0x5c04d4921a53b7c>) :enabled #f(compiled-function () #<bytecode 0x1fe1275a6801>) :items #f(compiled-function () #<bytecode 0x17fbb5053212b2b>)) (:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects)])
consult--multi(((:hidden nil :narrow 98 :name "Project Buffer" :narrow (112 . "Project") :hidden t :category buffer :face consult-buffer :history buffer-name-history :state consult--buffer-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :items #f(compiled-function () #<bytecode -0x818575f007b97a7>)) (:hidden nil :narrow 102 :name "Project File" :narrow (112 . "Project") :hidden t :category file :face consult-file :history file-name-history :state consult--file-state :new #f(compiled-function (file) #<bytecode 0x5c04d4921a53b7c>) :enabled #f(compiled-function () #<bytecode 0x1fe1275a6801>) :items #f(compiled-function () #<bytecode 0x17fbb5053212b2b>)) (:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects)) :require-match confirm-after-completion :prompt "Switch to: " :history consult--buffer-history :sort nil)
consult-buffer(((:hidden nil :narrow 98 :name "Project Buffer" :narrow (112 . "Project") :hidden t :category buffer :face consult-buffer :history buffer-name-history :state consult--buffer-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :items #f(compiled-function () #<bytecode -0x818575f007b97a7>)) (:hidden nil :narrow 102 :name "Project File" :narrow (112 . "Project") :hidden t :category file :face consult-file :history file-name-history :state consult--file-state :new #f(compiled-function (file) #<bytecode 0x5c04d4921a53b7c>) :enabled #f(compiled-function () #<bytecode 0x1fe1275a6801>) :items #f(compiled-function () #<bytecode 0x17fbb5053212b2b>)) (:name "Other Projects" :narrow (112 . "Projects") :hidden nil :category 'file :face consult-file :state consult--file-state :enabled #f(compiled-function () #<bytecode 0x1f4673792609>) :annotate consult-jump-project--annotate :action #f(compiled-function (cand) #<bytecode 0x17109c2b1a205aa8>) :items consult-jump-project--projects)))
consult-jump-project(nil)
funcall-interactively(consult-jump-project nil)
command-execute(consult-jump-project record)
execute-extended-command(nil "consult-jump-project" nil)
funcall-interactively(execute-extended-command nil "consult-jump-project" nil)
command-execute(execute-extended-command)
Seems that the consult-jump-project--projects
function doesn't account for an empty list of historical projects. Changing the definition to:
(defun consult-jump-project--projects ()
"Return list of (other) project roots.
The list is sorted by last file mod date among recently saved
files. Save details."
(let* ((projects (seq-filter
(lambda (dir)
(not (string-prefix-p
(expand-file-name dir) default-directory)))
(project-known-project-roots)))
(details (seq-map #'consult-jump-project--details projects)))
(setq consult-jump-project--max-age
(seq-max (or '(0) (seq-map (lambda (x) (nth 3 x)) details))))
(seq-map #'car
(setq consult-jump-project--details
(sort details (lambda (a b)
(or (not (nth 3 b))
(< (nth 3 a) (nth 3 b)))))))))
seems to do the trick, but it seems brittle and possibly-wrong somehow. WDYT?
Hi,
I was wondering if it is possible to call the narrowed buffers (buffer/file/project) directly.
Cheers!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.