Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counts are prefixed by C-u when displayed in the status bar #9741

Closed
ripread opened this issue Oct 15, 2017 · 6 comments
Closed

Counts are prefixed by C-u when displayed in the status bar #9741

ripread opened this issue Oct 15, 2017 · 6 comments
Labels
- Forum - Evil stale marked as a stale issue/pr (usually by a bot)

Comments

@ripread
Copy link

ripread commented Oct 15, 2017

Description :octocat:

In Vim you can type 123j to go down 123 lines. Emacs also has counts, you type C-u 123. Currently in Spacemacs when you type a partial command like SPC-h or g- the status bar will display the typed combination. When typing 123 the status bar displays C-u 123. Its a small thing but it really bothers me. Is there an easy way to fix it?

Reproduction guide 🪲

  • Start Emacs
  • type 123
  • look at status bar

Observed behaviour: 👀 💔

  • C-u 123- is displayed

Expected behaviour: ❤️ 😄

  • 123- is displayed

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.3.1
  • Spacemacs: 0.200.9
  • Spacemacs branch: master (rev. 8e1af14)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(ivy emacs-lisp git syntax-checking)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
@ghost
Copy link

ghost commented Oct 16, 2017

^_^, this is emacs' style, do not think like vim

@CeleritasCelery
Copy link
Contributor

The effect this the same, But evil is not vim.

@Alexander-Miller
Copy link
Contributor

Its actually more correct this way, the numbers you see do count as a prefix argument, which you most typically enable with C-u. So commands that behave differently with C-u will show the same behaviour when you first enter 12345 instead.

Though there probably is a way to change that. Youll need to dig into spaceline's segment definitions,.

@bmag
Copy link
Collaborator

bmag commented Oct 17, 2017

Turns out prefix-command-echo-keystrokes-functions controls the display of prefix arguments, and by default only universal-argument--description is hooked to it. Theoretically we could change it, but then it still needs to show C-u 123 in cases where C-u was actually pressed.

If you really want to change it:

(remove-hook 'prefix-command-echo-keystrokes-functions 'universal-argument--description)
(add-hook 'prefix-command-echo-keystrokes-functions 'whatever)

Where whatever is a function you need to write. For reference, here's how universal-argument--description is implemented in Emacs 25.1:

(defun universal-argument--description ()
  (when prefix-arg
    (concat "C-u"
            (pcase prefix-arg
              (`(-) " -")
              (`(,(and (pred integerp) n))
               (let ((str ""))
                 (while (and (> n 4) (= (mod n 4) 0))
                   (setq str (concat str " C-u"))
                   (setq n (/ n 4)))
                 (if (= n 4) str (format " %s" prefix-arg))))
              (_ (format " %s" prefix-arg))))))

By the way, the display area is called the "echo-area" (it also doubles as the minibuffer window). The status bar is usually called the "mode-line", and is above the echo-area. (Spaceline is a package that modifies the mode-line)

@bmag
Copy link
Collaborator

bmag commented Oct 17, 2017

I don't count this as a bug, so I labeled it as "Forum". You could report it as a bug to Evil upstream, but I don't think they'll consider it a bug either.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions GitHub Actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Evil stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

4 participants