What's the difference between `eval-expression` and `:Eval `? reddit / emacs ---------------------------------------------------------------------- hkjels · 2022-04-26 07:10 I prefer a clean frame for Emacs, so I've set `frame-title-format` to be empty, but whenever I resize the frame, the size of the frame is appended to the frame title. If I `:Eval (setq frame-title-format " ")` the frame-title is cleared. I've checked and that should be the equivalent of `eval-expression`, but doing `(eval-expression '(setq frame-title-format " "))` in a hook does nothing. Using `setq` directly also does nothing. So what's the difference between `eval- expression` and `:Eval`? Or, what's the difference between running a command immediately and running a command via hooks? I've also tried `(set 'frame-title-format " ")` thinking it's a scope- issue, but no luck ---------------------------------------------------------------------- 7890yuiop · 2022-04-26 08:13 What do you mean by `:Eval` ? ---------------------------------------------------------------------- hkjels · 2022-04-26 08:16 What is bound to `M-:` ---------------------------------------------------------------------- 7890yuiop · 2022-04-26 08:36 That's `eval-expression` ---------------------------------------------------------------------- 7890yuiop · 2022-04-26 08:44 > in a hook Which hook? > Using setq directly Where? When? You're omitting most of the information needed to answer your questions. ---------------------------------------------------------------------- hkjels · 2022-04-26 08:47 Doesn't matter which one. I've been using `(add-hook 'focus-in-hook 'elan-remove-title)` just to test it. And I can see that the hook is run cause I just placed a `message` in there. ---------------------------------------------------------------------- hkjels · 2022-04-26 09:01 ``` (defun elan-remove-title () (set 'frame-title-format " ")) (add-hook 'window-size-change-functions 'elan-remove-title) ``` Something along these lines is what I want and expected to work ---------------------------------------------------------------------- 7890yuiop · 2022-04-26 09:14 That's an abnormal hook -- your function has to accept its (documented) argument. `M-x elisp-index-search RET abnormal hook` > Doesn't matter which one. Evidentially it does. ---------------------------------------------------------------------- hkjels · 2022-04-26 09:47 I have verified that the hook is being run by outputting a message, so that's not the issue. ---------------------------------------------------------------------- hkjels · 2022-04-26 10:09 OK, from now reading a bunch of docs. This should really have been the proper way AFAICT. ``` (defun elan-remove-title (frame) (push '(title . " ") frame)) (add-hook 'window-size-change-functions 'elan-remove-title) ``` Although, it does however not work. I tried adding `run-at-time` to see if there's some race-condition of the text being set and that's not the case either. So, I'm back to there being a difference between manually running `:Eval` and using `set` or whatnot. I've also noticed, that this only occurs when I use a third-party app to scale the Emacs frame. If I use the mouse to scale the frame, `sets-default` suffice. ---------------------------------------------------------------------- ieure · 2022-04-26 16:55 Guessing this is some evil-mode thing. ---------------------------------------------------------------------- 7890yuiop · 2022-04-26 19:05 > I've also noticed, that this only occurs when I use a third-party app to scale the Emacs frame. I don't know what this means. Details are super important when asking people for help, and you have a tendency to make vague references to things but not actually specify what they are. I probably can't help with any "third-party app" in any case; but I'm confident that you have a better chance of someone else being able to if you provide actual details. My best suggestion is that you provide a recipe to reproduce the problem -- all the ingredients, and step-by-step actions in detail.