Tag: elisp

Initial focus in Occur Buffer

Just a quick one today! I am finding occur extremely useful, from building an index from my emacs init file to searching through org headers to generally just having my isearch all there in a single window. However I would rather the cursor would jump to the *Occur* buffer when invoked as it just feels a little more natural, so I added the following: (advice-add 'isearch-occur :after '(lambda (origin &rest args) (isearch-exit) (select-window (get-buffer-window "*Occur*")) (goto-char (point-min)) )) Read more...

Imenu Indexing My emacs Init File

After implementing my simple occur indexing in my last post : Indexing My Emacs Init File A suggestion was made to put this into an imenu. I thought that was rather a good idea and it would also give me the opportunity to explore imenu I came up with the following to add to the emacs init file : (add-hook 'emacs-lisp-mode-hook (lambda () (setq imenu-sort-function 'imenu--sort-by-name) (setq imenu-generic-expression '( (nil "^;;[[:space:]]+-> \\(. Read more...

Indexing My Emacs Init File

Since I keep all my emacs configuration in a single .emacs file and in a hyper organised manner it means I have my init file split into different sections, for example : platform packages mail calendar completion save-desktop keys modes setqs with each section delimited by a comment of the form: ;; ;; -> platform` ;; Now I am using occur more often, then why not write a function to produce a nice little Occur buffer containing an index of my init file sections, as thus: Read more...

Sorting Org Tags using Org Mode!

Well as always a little more time with emacs a little feedback and then finding more about org I have now figured out (I think) how I can better sort tags in an org file. In my previous post: Sorting Org Tags I made the following comment: I had assumed that org-mode came with the built-in ability to sort tags but I couldn’t find any evidence of this Well as it turns out there is evidence of this! Read more...

Sorting Org Tags

I use a package called org-rainbow-tags which adds random colours to org tags to provide a consistent colour between identical tags. This helps to identify common tags throughout the file but has the side effect of emphasising the lack of my coherent tag ordering. I would like to order the tags consistently, just for my own peace of mind! 😀 I had assumed tkhat org-mode came with the built-in ability to sort tags but I couldn’t find any evidence of this so I decided to create a method using my own function. Read more...

Replacing deadgrep with consult-ripgrep

I have been evolving my way through many differing ways of grepping recently from standard built-in greps to a few ripgrep front ends until I finally settled on deadgrep I am currently an ivy user but as everyone seems to be talking about vertico and the associated completion stack I thought I would give it a try and therefore consult-ripgrep to see it can improve on my deadgrep setup. Read more...

Commenting Un-commenting

After watching an interesting video by EmacsElements regarding commenting and un-commenting I have to say that I wholeheartedly agree. I really don’t like the way comment-dwim works and made me think back to one of the first elisp functions I commandeered from the interwebs : (defun my/comment-or-uncomment () "Comments or uncomments the current line or region." (interactive) (if (region-active-p) (comment-or-uncomment-region (region-beginning)(region-end)) (comment-or-uncomment-region (line-beginning-position)(line-end-position)))) and it is a command that I constantly use and had forgotten that it isn’t part of the emacs default functionality from a M-; Read more...

Simple Flexible Scrolling

I have written before about smooth scrolling using good-scroll and how I managed to find a semi satisfactory way of centering my cursor after a single scroll which meant I would then have a minimal amount of subsequent line movement to get to the line I want. However, I have since returned to a simple concept, more of a basic scroll-[up/down]-command which in its bare form scrolls a whole page. Read more...

How to Display Google Calendar

Emacs is subsuming me! I have managed to get email up and running using mu4e and rss using elfeed and image viewing with image-dired Next up is some form of calendar integration! Although I use Google Calendar I don’t rely on any google apps directly; an android app called Simple Calendar is adequate for my needs and enables the thing I cherish most of all (except emacs of course!) and that is the ability to produce an offline copy. Read more...

More flexible grepping with deadgrep

I seem to be grepping a lot recently and I think the way I use deadgrep can be improved a little. Currently deadgrep defaults to a recursive ripgrep from the default-directory which is generally the current directory of the buffer, but I find that by default I tend to mostly want to grep from a top level directory (yes I know, almost like a project!). I would like to have a typical Find All References type of functionality from my grepping and not to rely on xref as I will not necessarily ever know if any xref functionality is supported for any file that I am working on and for the moment I am not using any connection to an LSP server. Read more...

Tidying up Dired

Bit by bit I am getting to grips with dired and using this for more operations on my files. The next step is to reduce the listing width so that a listing fits better in a smaller window. Here is the format of my current listing: By default dired uses -al, which gives a standard long listing. Unfortunately for my work within emacs this is actually now too long, and also not just in emacs but in my terminal too. Read more...

Centering the Cursor After a Scroll

Something has been nagging at me for a while now, I seem to spend a lot of time moving the cursor to the next or previous line within a window, spamming C-n and C-p to get where I want to within a file. Why is this? Well I am scrolling quite often using C-v and M-v and this has a side effect on the cursor by pushing it to the top or bottom of the window. Read more...

Dired folder size

My dired replacement of Dolphin / linux terminal continues. The next thing is something useful to me but uncommon and something that dired didn’t seem to be able to do out of the box. That is to be able to recursively display the size of a folder / files. Every now and again I like to keep my files and data under control especially as I am using syncthing to backup my core data to my phone. Read more...

Cut / Copy between Windows using Dired Buffers

The next step in my emacs journey is to move files around a little more easily, in fact more like a regular file explorer using the concept of file / folder selection copy and paste. That concept seems a little more natural to me than dired file marking, renaming / copying and then entering the path of the destination address. After a little research the following options present themselves: Read more...

Efficient Deletion and Insertion

As my emacs keybindings journey continues to evolve and to delete more efficiently with delete word it has lead to an interesting issue for me. Typically, especially in my coding life I will typically copy a string to the clipboard, then go in and delete the target area and insert from the clipboard/kill-ring. Now I have moved from deleting with the delete key to the the M-delete-word concept it seems that deleting words automatically puts this to the clipboard/kill-ring, so when I paste in my original copy it pastes back in the last killed words. Read more...