Giter Site home page Giter Site logo

popup-switcher's Introduction

License GPL 2 MELPA

popup-switcher

popup-switcher provides (yet another) convenient way to switch buffers, navigation possibility through functions/methods and any other kind of switching you like. It's easy to use and extend for custom purposes. It uses popup lib for better sense.

Installation

Add MELPA (if not yet) to your package-archives list:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)

Then you can install popup-switcher with the following command:

M-x package-install [RET] popup-switcher [RET]

Load popup-switcher:

(require 'popup-switcher)

Configuration

Keybindings

Add a hotkey to psw-switch-<X> to you taste (for the full list of predefined switching functions see Usage section), e.g.:

(global-set-key [f2] 'psw-switch-buffer)

Functions/methods navigation

Uses imenu to navigate through functions/methods names via psw-switch-function.

(global-set-key [f3] 'psw-switch-function)

Maximum number of visible items

Set maximum number of visible items in popup menus

(setq psw-popup-menu-max-length 15)

Menu position

Menu opens centered with respect to fill-column by default. Set psw-popup-position variable to change horizontal positioning.

Possible values are:

  • fill-column - center relative to fill-column (default setting)
  • center - center relative to window borders
  • point - open popup at point
(setq psw-popup-position 'center)

Fuzzy matching

Non-nil psw-use-flx enables flx fuzzy matching engine for isearch in popup menus. flx-ido is required in this case, it can be installed by your favorite approach. E.g. by MEPLA: M-x package-install [RET] flx-ido [RET]

(setq psw-use-flx t)

Modified buffers marker

Non-nil psw-mark-modified-buffers means mark modified buffers with star char (*) expect special beffers like *Messages* any time you call psw-switch-buffer.

Enter to dired-mode via psw-navigate-files

(setq psw-enable-single-dot-to-navigate-files t)

Any time you run psw-navigate-files fn you can select dot . item, which opens dired-mode for current directory.

Highlight previous buffer for psw-switch-buffer

If you want to highlight previous buffer for psw-switch-buffer fn set psw-highlight-previous-buffer to t:

(setq psw-highlight-previous-buffer t)

Usage

List of interactive functions:

Command Description
psw-switch-buffer switch buffers through popup menu
psw-switch-recentf switch recent files
psw-navigate-files simple file navigator
psw-switch-function switch (navigate) through functions in the current buffer (optional)
psw-switch-projectile-files switch among projectile project files list (optional)
psw-switch-projectile-projects switch among projectile projects list and it's files (optional)

Run M-x psw-switch-buffer [RET] (or your selected key). Type some letters from the name of buffer of interest (since isearch is enabled on start) to filter buffers list, use arrow keys and [RET] or mouse to select buffer.

When you are in menu created by psw-switch-buffer, you can kill selected buffer by pressing C-d or C-k.

Screenshots

Switch buffer (psw-switch-buffer)

Switch function (psw-switch-function)

Fuzzy matching for switch function

File navigator (psw-navigate-files)

Requirements:

License

Copyright © 2013-2020 Kostafey [email protected] and contributors

Distributed under the General Public License 2.0+

popup-switcher's People

Contributors

ancane avatar kostafey avatar pierre-rouleau avatar syohex avatar tam17aki avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

popup-switcher's Issues

Heisenbug in psw-switch-function?

I have seen strange behaviour of psw-switch-function, where it sees the items but does not move point to the selected one.

On some files (for example my 1-function pel-benchmark.el) executing psw-switch-function changes the markers value inside imenu--index-alist which then prevents it (and any other imenu based navigation) from moving point to the proper location.

I started investigating and have identified that when this happens, the imenu--index-alist is modified during the execution of pew-switcher doing it's (funcall switcher (psw-get-item-by-name ...)) form. I instrumented the code with extra (message) forms to dig further and then the issue disappeared. It now works fine with all instrumentation removed....

I saw this issue with Emacs 26.3 and 27.1. I was trying to debug on Emacs 26.3. I tried debug-on-variable-change on imenu--index-alist but it did not trigger. I wonder if it was modified by lax-plist-get called by paw-get-item-by-name. This function is written in C and would not trigger debug-on-variable-change.

Now that I can't reproduce the problem, and I know I've seen it happening, I am wondering what else I can do to investigate the issue. Any idea would be welcome.

I wrote this issue in case someone has seen the problem and has some ideas as to where the problem could be. I'll continue investigating if I can reproduce the issue again. When it was occurring it was occurring all the time.

Highlight current buffer

psw-switch-buffer list buffer menu, always highlight current file, I think highlight previous buffer will be better.

Flx matching drops duplicates

Hi. There is small problem for popup-imenu in regard to flex matching: it doesn't tolerate duplicates at the moment. The thing is that imenu may contain items, like overloaded methods, that I'd like to match and switch between them. My suggestion would be to drop flx-ido dependency and implement flx-popup here, to be able to fully control flx match in a way, appropriate for particular switching function. What do you think?

Can you add please popup for killing buffers?

I use your plugin as replacement for standard commands for finding files, switching buffers and opening recent files. But there is similar pattern for killing buffer(s). Can you please add popup for this function too?

I see that this popup should kill buffer and close after pressing RET and kill buffer, but not close (until there are no available buffers) when desired buffer is selected and I press k or d to be able to kill more than one buffer invoking popup only once.

Invalid function: (ask-user-about-supersession-threat (_))

Hello, when trying to invoke psw-switch-buffer or psw-switch-function I get the following error:

Debugger entered--Lisp error: (invalid-function (ask-user-about-supersession-threat (_)))
  (ask-user-about-supersession-threat (_))()
  psw-popup-menu(:item-names-list ("index.php" "*scratch*" "*Messages*" "*straight-process*" "*Compile-Log*" "*lsp-log*" "*iph*" "*iph::stderr*") :fallback #f(compiled-function (key _) #<bytecode 0x1832365>) :position nil :initial-index nil)
  psw-switcher(:items-list (#<buffer index.php> #<buffer *scratch*> #<buffer *Messages*> #<buffer *straight-process*> #<buffer *Compile-Log*> #<buffer *lsp-log*> #<buffer *iph*> #<buffer *iph::stderr*>) :item-name-getter #f(compiled-function (buffer) #<bytecode 0x1832329>) :switcher switch-to-buffer :fallback #f(compiled-function (key _) #<bytecode 0x1832365>) :initial-index nil)
  psw-switch-buffer()
  funcall-interactively(psw-switch-buffer)
  call-interactively(psw-switch-buffer record nil)
  command-execute(psw-switch-buffer record)
  execute-extended-command(nil "psw-switch-buffer")
  smex-read-and-run(("toggle-debug-on-error" "psw-switch-function" "psw-switch-buffer" "projectile-switch-project" "projectile-discover-projects-in-directory" "customize-group" "projectile-find-file" "straight-rebuild-package" "mark-whole-buffer" "customize-face" "flymake-mode" "comment-region" "uncomment-region" "describe-variable" "indent-region" "describe-font" "yas-reload-all" "customize-variable" "customize" "compile-llncs-and-open" "global-display-line-numbers-mode" "lsp-mode" "lsp-rename" "company-yasnippet" "fringe-mode" "lsp-ui-mode" "org-version" "describe-face" "line-number-mode" "lsp-organize-imports" "lsp-workspace-show-log" "org-reload" "company-box-mode" "window-divider-mode" "what-cursor-position" "imenu" "what-face" "linum-mode" "lsp-ui-imenu" "flycheck-mode" "report-emacs-bug" "lsp-format-buffer" "copy-region-as-kill" "lsp-describe-session" "show-paren-mode" "describe-function" "lsp-ui-sideline-mode" "flycheck-verify-setup" "lsp-restart-workspace" "lsp-workspace-restart" ...))
  smex()
  funcall-interactively(smex)
  call-interactively(smex nil nil)
  command-execute(smex)

Emacs 26.3

Opens symlink to directories in dired-mode

I have a symlink to Dropbox directory on another partition. Whenever I select this symlink it opens the Dropbox directory in dired-mode and closes psw-navigate-files popup. This is not what I expect to happen. This should only happen when I use . for the current directory.

Readme screenshots "not found"

The readme screenshots show a broken image icon, at the bottom of the Usage section:
https://github.com/kostafey/popup-switcher#usage

Clicking on them opens a blank page with the text: Not Found

They link to:

<img src="https://dl.dropboxusercontent.com/u/820526/psw-switch-buffer.png" width="600" />
<img src="https://dl.dropboxusercontent.com/u/820526/psw-switch-function.png" width="600" />

It might be better to host them on Github.

pupup-switcher and dired

Trying to call function psw-switch-buffer fails if dired was started.
Minibuffer message: Args out of range: "~", 0, 2.
After closing dired, popup-switcher works good again.

GNU Emacs 24.3.1, popup-switcher 0.2.2

popup-switcher does not work

popup-switcher does not work already long time. It just does not show popup menu. Environment: Arch Linux, GNU Emacs 24.4.1, popup 20141215.349 (0.5.2). popup-switcher 20141224.326 (0.2.6).
Backtrace:
Debugger entered--Lisp error: (void-function remove-if)
(remove-if (function (lambda (buf) (or (minibufferp buf) (let ((buf-name (buffer-name buf))) (and (>= (length buf-name) 2) (equal (substring buf-name 0 2) " *")))))) (buffer-list))
psw-get-buffer-list()
(psw-switcher :items-list (psw-get-buffer-list) :item-name-getter (quote buffer-name) :switcher (quote switch-to-buffer))
psw-switch-buffer()
call-interactively(psw-switch-buffer nil nil)
command-execute(psw-switch-buffer)

pupup-switcher and org-mode

After opening *.org file (org-mode is activated automatically), first call to psw-switch-buffer shows popup menu incorrect. I can select menu item only by mouse. Next, function psw-switch-buffer works correctly.

GNU Emacs 24.3.1, popup-switcher 0.2.2

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.