Code Monkey home page Code Monkey logo

consult-jump-project's People

Contributors

jdtsmith avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cxa syohex

consult-jump-project's Issues

First time usage invokes `max` with no arguments

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.