![]() ![]() Hope that makes sense! Feel free to ask anything else if it doesn’t. Then I bind a key to ejmr/toggle-writing-mode, using either define-key or global-set-key (using C-h f will help you understand these functions), and then I’m good to go. You can see how the two use -1 and 1 as ways to enable or disable Olivetti and the menu-bar, respectively. Unlike the cluttered word processors youre used to, WriteRoom lets you focus on writing. If Olivetti is not enabled then the function turns it on and effectively performs the inverse of all of the above. WriteRoom is a full screen writing environment. Like point number one, this is a common way to turn on a mode. (menu-bar-mode 1) Re-enable the menu bar.You can use C-h w (“whereis”) to find out which keys such commands are bound to. (toggle-frame-fullscreen) A built-in Emacs function.(olivetti-toggle-hide-modeline) Restore my mode-line.(olivetti-mode -1) A common way to turn off a mode.If Olivetti is enabled then the function turns it off: So this is how the function does two different things depending on whether or not olivetti-mode is enabled. If the mode is enabled then bound-and-true-p will return true. The function bound-and-true-p is a useful way to tell if a minor mode is enabled. The function has two conditions: (cond ((bound-and-true-p olivetti-mode) ![]() In this case it’s similar to if-else constructs, if you’re familiar with those from other programming languages. The rest of the function is a ‘condition’, created by cond. it allows me to do stuff like M-x ejmr/toggle-writing-mode. That (interactive) part makes the function available as a command, e.g. "String explaining what the function does." It often looks like this: (defun name (paramaters) …could just give me a quick run down it'd be great.ĭefun defines a function. ![]()
0 Comments
Leave a Reply. |