ajsalminen / helm-fasd

An async helm source of fasd search results for emacs.
9 stars 5 forks source link

helm-fasd issue if used together with sunrise-commander #7

Open wafgo opened 2 years ago

wafgo commented 2 years ago

Hi, if using helm-fasd together with the sunrise-commander the following error occurs as soon as you try to open a sunrise pane via "M-x sunrise-cd"

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  make-process(:name "*fasd*" :buffer nil :command ("fasd" "--add" nil))
  start-process("*fasd*" nil "fasd" "--add" nil)
  (let ((file (if (string= major-mode "dired-mode") dired-directory (buffer-file-name)))) (start-process "*fasd*" nil "fasd" "--add" file))
  helm-find-fasd-add-file()
  run-hooks(change-major-mode-after-body-hook dired-mode-hook sunrise-mode-hook sunrise-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook dired-mode-hook sunrise-mode-hook sunrise-mode-hook))
  run-mode-hooks(sunrise-mode-hook)
  sunrise-mode()
  (let ((dired-listing-switches dired-listing-switches) (sorting-options (or (get sunrise-selected-window 'sorting-options) ""))) (if (string-match tramp-file-name-regexp default-directory) nil (setq dired-listing-switches (concat sunrise-listing-switches sorting-options))) (sunrise-mode) (dired-unadvertise dired-directory))
  (if (and (not (eq major-mode 'sunrise-mode))) (let ((dired-listing-switches dired-listing-switches) (sorting-options (or (get sunrise-selected-window 'sorting-options) ""))) (if (string-match tramp-file-name-regexp default-directory) nil (setq dired-listing-switches (concat sunrise-listing-switches sorting-options))) (sunrise-mode) (dired-unadvertise dired-directory)))
  sunrise-dired-mode()
  dired-readin()
  dired-internal-noselect("~/.emacs.d/custom/" nil)

The following patch fixes the problem, eventhough i dont think this is the right way doing it

--- a/helm-fasd.el
+++ b/helm-fasd.el
@@ -89,7 +89,7 @@
 (defun helm-find-fasd-add-file ()
   "Add file to fasd database."
   (unless (executable-find "fasd") (error "Helm-search-fasd: cannot find the fasd executable"))
-  (let ((file (if (string= major-mode "dired-mode") dired-directory (buffer-file-name))))
+  (let ((file (if (or (string= major-mode "dired-mode") (string= major-mode "sunrise-mode") ) dired-directory (buffer-file-name))))
     (start-process "*fasd*" nil "fasd" "--add" file)))