Fork me on GitHub
#spacemacs
<
2019-07-02
>
jaide04:07:33

Does this finite-state-machine diagram accurately model a spacemacs-like menu? I’m working on a program that has a similar mnemonic menu while also learning state machines. Figured this would be the best place to ask 😅

ag04:07:53

looks right I think, but it’s hard to tell without Submenu. So in what state the Previous (main menu) would be when Sebmenu activates?

ag04:07:31

Spacehammer currently keeps the main modal active even when you are in a sub-modal, which is not right. e.g. when you press Cmd+SPC then m - it opens Multimedia modal, but Main modal keys are still active, you still can press w and jump to Windows modal - this isn’t right

ag04:07:58

I’ve been thinking about rewriting it, but I’ve been pretty swamped on my full-time job

jaide04:07:56

https://github.com/eccentric-j/spacehammer/blob/develop/modals2.fnl it is crudely solved in my solution. I create a new hs.hotkey.modal every time a menu is activated. Upon activating a new modal, it clears bindings before setting new ones by deleting the hotkey modal. It seems to work pretty well, even got the repeatable: true flag in the top config working so things like volume can be repeated. In terms of an FSM I think it would be about responding slightly differently when transitioning to active while already active

jaide05:07:32

It stores a list of active paths in the state atom

jaide05:07:25

So like [:w :m] would look up the menus for window bound to :w, then the submenu move bound to :m

jaide05:07:48

It’s kind of a good thing you did not get a chance to write it. A coworker wants to use a FSM to solve a problem at work and up until the past two days, I didn’t know much about them. I would not be able to help design it or even review it. This project is a great opportunity for me to learn how to implement one on my own given your pretty solid framework 😁

jaide15:07:36

Oof I am interested in using this package with spacemacs https://github.com/emacsmirror/fennel-mode but I’m not sure how to add it. I don’t think it’s on MELPA which means I have to clone it somewhere?

ag16:07:24

Fennel-mode is on MELPA

jaide16:07:00

Oh! Sorry about that, I was looking at the readme instructions. I’ll just wrap it in a spacemacs layer then. Thanks!

jaide16:07:23

Hah wow wrapping it in a layer was ridiculously easy.

ag16:07:28

you may wanna do something like this:

(use-package fennel-mode
    :init
    (autoload 'clojure-align "clojure-mode" nil t)
    :config
    (spacemacs/set-leader-keys-for-major-mode
      'fennel-mode
      "fl"
      'clojure-align))

jaide17:07:07

Thanks, I’ll try that out

eggsyntax20:07:21

Hey folks! Anyone know a good way to hard-wrap an HTML document in SM? fill-region results in ugly (but presumably valid) line breaks, eg between a and href. Any option that's a bit more sensitive to the HTML-ness of the buffer?

ag20:07:12

I think web-mode should handle HTML properly on M-q

ag20:07:29

it’s been ages since the last time I used it, but I think that what it does

eggsyntax20:07:30

Hmm, still doesn't do very well for me. eg doing M-q on a single (very long line) leaves me with (excerpt)

<p>If you've moved or changed your name, please update your voter registration.
  We can help you get started at <a
  href="https://{{recipient.hostname}}/">{{recipient.hostname}}</a>. Once that's
  done, you should <a
Again, presumably valid, but pretty unpleasant for the reader. That said, this is using the hbs wrapper around handlebars, so it may not be recognized as a valid template file. Does say it's in web-mode, though. As a sanity check (since I'm evil-mode), I've got M-q bound to fill-paragraph. I assume it's the same for you?

ag20:07:08

yeah, M-q is Emacs’s native

eggsyntax20:07:38

Oh, no, that web-mode page does have hbs listed, so it's not that. Oh well! "Pretty" as well as valid may be asking too much 🙂

eggsyntax20:07:45

Thanks ag, I appreciate it!

ag21:07:12

> may be asking too much when it comes to Emacs, it is never too much. You just need to know/find what to tweak and where

eggsyntax13:07:20

Heh, true that 😆