My Must Emacs Functions

İsmail Efe Top

2024-03-06

I love Emacs because the possibilities are endless. What makes it so capable is definitely Emacs Lisp. Thanks to this language, countless functions have been created to meet the needs of us users.

As a student who uses Emacs everyday for writing, there are several and functions that I depend on. Here are some of them.

view-echo-area-messages

I remember when I first started configuring Emacs, I would get a lot of error messages. And the worst part would be that these message would fade after few seconds. I would try to take pictures of the error messages so that I could Google it.

One day I was having too many errors and decided to find a way to see those messages. That's when I came across 'view-echo-area-messages'.

This opens a messages buffer and shows a history of the things that was in your echo area.

describe-function and describe-variable

By no means is Emacs an undocumented text editor, but accessing documentation when you are a beginner can be hard. A lot of users are looking for information online and blaming the community when they can't find it.

Most of the time, documentation of the thing you are looking for is already inside of Emacs! If you are searching for a particular function or want to know what a function does, you can use the 'describe-function' command. And if you can't find what you are looking for you can always write your own function.

When you are writing a function that builds upon what Emacs already offers (this is the case most of the time!), you can use the 'describe-variable' command. This command tells you more about what that variable does and how you can use it. Both of these commands can also tell you their global and local states and much more.

ispell

I am definitely a fast writer, but not an accurate one. I always mess up words when I am writing my thoughts. So a good spellchecker is a must for me. A spellchecker should be fast, lightweight and customizable. So it shouldn't slow down my system when I am spellchecking and I should be able to add words to my dictionary easily. While I did spend some time using other spellcheckers I liked using ispell the most. It is built-in, lightning fast and easy to use. It is probably my most used command. I usually use 'ispell-word' for correcting words that I know are wrong. And use 'ispell' to correct all the words that I forgot to correct at the end of my writing.

I know ispell is even older than Emacs but it still works for me.

org-insert-structure-template

As the name suggests, this command inserts different templates to your file. I used this a lot when I was writing my literate config. With this command, you can insert code blocks, html export blocks, quote blocks and much more. It is easily customizable and definitely a time saver.

Image of an Emacs window with the command 'org-insert-structure-template running'

google-current-word

Currently, I am taking an introduction to literature class and learning a lot of words that I didn't know before. I best learn using different sources, so my first step is almost always searching it on Google.

Whenever our instructor introduces a new term, I put it in my org file. Then when I want to write a definition for that word, I need Google to help me. So, I wanted a function that takes the current word my cursor is on and searches it on Google. I looked for a package to do that for me and there was one. But sadly, it wouldn't work on my system. So, with the help of u/Aminumbra, I was able to create a function that does exactly what I want.

(defun google-current-word ()
  "Search the current word on Google using browse-url."
  (interactive)
  (let ((word (thing-at-point 'word)))
    (if word
        (browse-url (concat "https://www.google.com/search?q=" word))
      (message "No word found at point."))))

Conclusion

I hope you find some of my recommendation useful. These functions may be commonplace for some but I am sure that there are a lot of people who might benefit from these. If you have any critisims or advice, please reach me on ismailefetop@gmail.com

Home Mail Me RSS Source
🔥⁠🐓