Code Monkey home page Code Monkey logo

Comments (10)

alphapapa avatar alphapapa commented on July 19, 2024

Do you mean something like this?

(defun helm-bufler-path-source (path)
  "Return Helm source for Bufler group at PATH.
PATH is a Bufler path, e.g. like the value of the frame parameter
`bufler-workspace-path' after calling `bufler-workspace-focus-buffer'."
  (let ((source-name (concat "Bufler: " (bufler-format-path path))))
    (helm-make-source source-name 'helm-source-sync
      :header-name source-name
      :candidates (lambda ()
                    (let* ((bufler-vc-state nil)
                           (group-path (unless current-prefix-arg
                                         ;; FIXME: This initial-nil-skipping logic probably belongs elsewhere.
                                         (if (car path) path (cdr path)))))
                      (bufler-buffer-alist-at group-path)))
      :action (cons (cons "Switch to buffer with Bufler" 'helm-bufler-switch-buffer)
                    helm-type-buffer-actions))))

(helm :sources (list (helm-bufler-path-source '("Projectile"))))

from bufler.el.

Pfedj avatar Pfedj commented on July 19, 2024

Can't reproduce, because if I try to eval
(helm :sources (list (helm-bufler-path-source '("Projectile"))))

I get this error:

(void-variable path)

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

It requires lexical binding.

from bufler.el.

Pfedj avatar Pfedj commented on July 19, 2024

I tried replacing let* with lexical-let, now there are no candidates in helm. The same thing when I moved the code to helm-bufler.el

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

I tried replacing let* with lexical-let

That's not how lexical binding works in Emacs.

Place this code in an Elisp buffer, save it to a file, revert the buffer, and evaluate it:

;; -*- lexical-binding: t; -*-

(defun helm-bufler-path-source (path)
  "Return Helm source for Bufler group at PATH.
PATH is a Bufler path, e.g. like the value of the frame parameter
`bufler-workspace-path' after calling `bufler-workspace-focus-buffer'."
  (let ((source-name (concat "Bufler: " (bufler-format-path path))))
    (helm-make-source source-name 'helm-source-sync
      :header-name source-name
      :candidates (lambda ()
                    (let* ((bufler-vc-state nil)
                           (group-path (unless current-prefix-arg
                                         ;; FIXME: This initial-nil-skipping logic probably belongs elsewhere.
                                         (if (car path) path (cdr path)))))
                      (bufler-buffer-alist-at group-path)))
      :action (cons (cons "Switch to buffer with Bufler" 'helm-bufler-switch-buffer)
                    helm-type-buffer-actions))))

(helm :sources (list (helm-bufler-path-source '("Projectile"))))

from bufler.el.

Pfedj avatar Pfedj commented on July 19, 2024

The same thing: executed without errors, but there are not any candidates in helm.

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

It works for me, e.g. to see buffers in the *Special* group:

(helm :sources (list (helm-bufler-path-source '("*Special*"))))

from bufler.el.

Pfedj avatar Pfedj commented on July 19, 2024

It works for me with *Special* too, but not with Projectile.
This is my init.el:

(use-package projectile
  :straight t
  :config
  (projectile-mode 1)
  (setq projectile-completion-system 'helm))

(use-package helm
  :straight t
  :config
  (helm-mode 1))

(use-package bufler
  :straight t)


(use-package helm-bufler
  :straight t)

(defun helm-bufler-path-source (path)
  "Return Helm source for Bufler group at PATH.
PATH is a Bufler path, e.g. like the value of the frame parameter
`bufler-workspace-path' after calling `bufler-workspace-focus-buffer'."
  (let ((source-name (concat "Bufler: " (bufler-format-path path))))
    (helm-make-source source-name 'helm-source-sync
      :header-name source-name
      :candidates (lambda ()
                    (let* ((bufler-vc-state nil)
                           (group-path (unless current-prefix-arg
                                         ;; FIXME: This initial-nil-skipping logic probably belongs elsewhere.
                                         (if (car path) path (cdr path)))))
                      (bufler-buffer-alist-at group-path)))
      :action (cons (cons "Switch to buffer with Bufler" 'helm-bufler-switch-buffer)
                    helm-type-buffer-actions))))

(helm :sources '(helm-bufler-source))

(helm :sources (list (helm-bufler-path-source '("Projectile:"))))

(helm :sources (list (helm-bufler-path-source '("*Special*"))))

I can see some Projectile candidates with (helm :sources '(helm-bufler-source)), but there are not any candidates with (helm :sources (list (helm-bufler-path-source '("Projectile:"))))

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

The code (helm-bufler-path-source '("Projectile:")) requires that there be a group named Projectile: in your configured groups.

from bufler.el.

Pfedj avatar Pfedj commented on July 19, 2024

I have this config for bulfer-group:

  (setq bufler-groups
        (bufler-defgroups
          (group
           ;; Subgroup collecting these "special special" buffers
           ;; separately for convenience.
           (name-match "**Special**"
                       (rx bos "*" (or "Messages" "Warnings" "scratch" "Backtrace") "*")))
          ;; All buffers under "~/.emacs.d" (or wherever it is).
        (group
         ;; Subgroup collecting buffers in a projectile project.
         (auto-projectile)))

With M-x bufler at least I can see a few groups named Projectile: *project-name1* Projectile: *project-name2* and etc. in my case.
I would like to add all this groups to helm-mini-default-sources.

from bufler.el.

Related Issues (20)

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.