Code Monkey home page Code Monkey logo

Comments (6)

alphapapa avatar alphapapa commented on July 19, 2024

There isn't any configuration for that. See

(cl-sort buffers #'string< :key #'buffer-name)))

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

If you wanted to implement something like that, you could probably model it on tab-line-tabs-window-buffers.

from bufler.el.

xl666 avatar xl666 commented on July 19, 2024

Thanks a lot, I can do the customization with that information.

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

Please let me know what you come up with, or feel free to submit a PR.

from bufler.el.

xl666 avatar xl666 commented on July 19, 2024

I investigated how tab-line uses tab-line-tabs-buffer-group-sort-function and it turns out that it only uses it inside seq-sort functions as a sort predicate, the name of the variable is misleading, it should be something like tab-line-tabs-buffer-group-sort-predicate-function, but anyway, this makes easy to integrate the same behaviour in bufler's existing code, I just redefined bufler-workspace-buffers as follows:

(cl-defun bufler-workspace-buffers (&optional (frame (selected-frame)))
  "Return list of buffers for FRAME's workspace.
Works as `tab-line-tabs-function'."
  ;; This is specifically for `bufler-workspace-tabs-mode', but it
  ;; needn't be only for that, so it probably belongs here.
  (let (buffers)
    (--tree-map-nodes (bufferp it)
                      (push it buffers)
                      (bufler-buffers :path (frame-parameter frame 'bufler-workspace-path)))
    (if tab-line-tabs-buffer-group-sort-function
	(cl-sort buffers tab-line-tabs-buffer-group-sort-function)
      (cl-sort buffers #'string< :key #'buffer-name))))

In this way the customization is the same as in tab-line and is optional, preserving the original bufler sorting (maybe expected by
other users).

With this I can customize the predicate function to do the sorting as I want.

I also noted a tab-line-tabs-buffer-groups-sort-function (note the additional s in groups) that I think sorts tab-bar elements, but I'm
not sure, and there is no documentation in the code. Maybe a similar customization can be done in that case.

from bufler.el.

alphapapa avatar alphapapa commented on July 19, 2024

I'll look at this again in the future. It's likely that bufler-workspace-tabs-mode will need to be adjusted or rewritten for changes in Emacs 27/28, and I'll have to do that after testing it for a while.

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.