42

fill-column-indicator is the most mature solution, and if you find overlay-based code with which it conflicts, you can add code to suspend fci-mode while the conflicting code is active. For example, the following code makes it work with auto-complete: (defun sanityinc/fci-enabled-p () (symbol-value 'fci-mode)) (defvar sanityinc/fci-mode-suppressed nil) ...


24

Here is one option which is more robust, it breaks almost nothing (occasionally company-mode being a noteworthy exception), but is not as convenient as fill-column-indicator. Use header-line-format to mark the 80th column on the header. Something like the following should suffice: (setq-default header-line-format (list " " (make-string 79 ?-...


22

Are there any better alternatives? Emacs 27 added support for a fill column indicator natively by way of the buffer-local minor mode display-fill-column-indicator-mode and its global counterpart global-display-fill-column-indicator-mode. Here it is in action: Quoth (info "(emacs) Displaying Boundaries"): 14.15 Displaying Boundaries ===============...


19

After much suffering because of various bugs fill-column-indicator introduces, I eliminated it from my config for good. What I currently use is built-in Emacs functionality to highlight lines that are too long. This even looks better, I wouldn't enable fill-column-indicator now even if it were bug-free. For a start you may grab my setup: (setq-default ...


18

You might want to try using org capture. When you initiate org-capture from your source file it will insert a TODO item into an org-mode file with a link to the relevant area in the source code. org-capture is smart enough to capture context-sensitive links--for instance, if you invoke it within a message in GNUS, it will capture a link directly to that ...


17

fixmee-mode offers highlighting of such notes and navigation. It is easily installed from MELPA and supports varying priorities of todo items.


14

If you are writing C/C++/Java/Emacs Lisp/Python, then semantic-sticky-func-mode will do what you want. NOTE: This seems to be working with CEDET from Git, not stock CEDET currently in Emacs 24.4. To get Emacs from Git: git clone http://git.code.sf.net/p/cedet/git cedet And load CEDET first above everything else in your init file: (load-file (concat ...


12

There are a number of add-on packages that might help, such as paredit, smartparens, and lispy. These packages make it easier to navigate and manipulate lisp code so that you can think in s-expressions and let the editor worry about balancing parens. Emacs also has lots of built-in commands for dealing with sexps and lists that are worth learning and may ...


9

This sounds a lot like you've followed this Emacs Redux blog post which is using which-func-mode. It explains its purpose (displaying the current function point is within), demonstrates how to enable and customize it and offers the following snippet to put the indicator in the header line: ;; Show the current function name in the header line (which-...


7

This EmacsWiki page has lots of information about different ways to mark a particular column or otherwise let you know when you go past it. The one I use is Mode Line Position. But others include showing a vertical line at the column (Column Marker, Fill-Column Indicator) and using whitespace mode to highlight text that goes past the column. (If you ...


6

Not exactually what you want, but ruler like @Malabarba♦ will waster space, here is better solution: There is a built-in package in emacs-goodies-el(recommend to install it in terminal) called highlight-beyond-fill-column.el, add this to your .emacs or init.el: (setq-default fill-column 80) (add-hook 'prog-mode-hook 'highlight-beyond-fill-column) (custom-...


6

You'll get used to it over time, but of course there's lots you can do to help speed it up: Indentation There's a method to this madness. In lisp you can do this: (a-fun (another-fun (magic-macro 1))) Suppose that 1 is really a large expression, and you want to indent it on its own line. (a-fun (another-fun (magic-macro 1))) This is misleading. 1 is ...


6

A good way to edit LISP is by manipulating the AST, instead of the individual characters or lines. I've been doing that with my package lispy that I started 2 years ago. I think that it can actually take quite a bit of practice to learn how to do this well, but even using just the basics should already help you. I can explain how I would go about making ...


6

You can turn on which-function-mode by doing M-x which-function-mode RET To make the setting permanent, add (which-function-mode 1) to your init-file. From the documentation: Toggle mode line display of current function (Which Function mode). [...] Which Function mode is a global minor mode. When enabled, the current function name is ...


5

I'm including this as a different answer. Sometimes, indentation will fail you. Your recourse then, is to use something like rainbow-delimiters: This makes the nesting level of any paren explicit and easily scanned. There is one pretty big problem though: the parens are ludicrously distracting. There's a balance of emphasis here. rainbow-delimiters will ...


5

I think geiser-mode may provide what you are looking for at least for guile and racket, but apparently not MIT Scheme. I know that provides M-. to jump to symbol definition in environment, completion, and inline documentation help. Take a look at the introduction, and cheat sheet for a quick overveiw of features. Alternative, it does appear mit-scheme has ...


5

For the reasons you provided, I generally prefer to hold on to the buffer. Then I write a foo-proc function which returns the corresponding process, potentially re-starting it if needed. And I even sometimes then write a foo-buffer function which calls foo-proc so that not only it gives me the buffer but it also ensures that the process is running.


5

eldoc-mode does precisely this. From the wiki page: A very simple but effective thing, eldoc-mode is a MinorMode which shows you, in the echo area, the argument list of the function call you are currently writing. Very handy. By NoahFriedman. Part of Emacs. ElDoc works for EmacsLisp and certain other language modes that implement support for ElDoc. These ...


4

After reading the comments in a previous answer, it appears that you would like to write a font-lock rule which would match one regexp without case, whereas the others would still be matched with a case. The easiest way to do this is to break out the matcher of the font-lock rule to a function, for example: Before: ... (MY-REGEXP (0 font-lock-variable-...


4

If you indent your code, then you really need to indent it properly. Lisp developers have expectations what properly indented should look like. This does not mean the code looks all the same. There are still different ways to format code. how long should a line be? how to distribute a function/macro call over lines? how many spaces of indentation should ...


3

Mark the region where your print statements are and perform this: M-xflush-lines ^ *print.* enter Which will delete all the lines in your region that match a line that has zero or more spaces followed by the word print, followed by anything. You can wrap this up in a function if you'd like: (defun delete-print-lines (beg end) "Delete all lines in the ...


3

I'd set up a periodic timer to check for the condition and cancel the timer when the condition becomes true. Since it requires a little bit of higher-order programming, it's somewhat easier with lexical binding (no need for backquote surgery). ;;-*- lexical-binding: t -*- (defvar piziak-timer nil "The currently active Piziak-style timer") (defvar ...


3

(Nearly) all programming modes inherit from prog-mode, so you can set the variable in prog-mode-hook: (defun my-prog-mode-hook () (setq tab-width 2)) (add-hook 'prog-mode-hook #'my-prog-mode-hook) (Note that you could use a lambda instead, but this way you'll have an easier time removing the hook if you ever want to do so.)


3

You can add not only action but any other attributes to a text-button, that can be referred later with button-get function. So saving the (reference to the) current buffer, together with action, seems a good idea here. (insert-text-button "realgud-cmdbuf-info" 'buffer buffer 'action (lambda (b) (with-current-buffer (button-get b '...


3

The original behaviour you describe sounds like blink-matching-paren: blink-matching-paren is a variable defined in simple.el. Non-nil means show matching open-paren when close-paren is inserted. If t, highlight the paren. If `jump', move cursor to its position. The new behaviour you are seeing sounds like show-paren-mode. From the help for ...


3

Emacs calls a function definition a “defun”, because defun is the keyword¹ that starts a function definition starts in Lisp. Commands to move by defuns use the modifiers Ctrl+Alt: C-M-a and C-M-e to move to the beginning/end of the current function definition; C-M-h to select the current function definition. This is somewhat similar, but not strictly ...


2

Whilst not entirely on-topic for emacs, I use the simple trick of creating the stub of the method/property/whatever when I hit that 'to do' moment, containing nothing more than an assertion that says "Write Me!" or similar. The code then compiles cleanly, and tells me at runtime where my TODO items are.


2

You can actually do this with a replace-regexp because in your replacement, you can evaluate elisp. Given this code: var stuff = { foo: [1], foo: [2], foo: [3], foo: [4], foo: [5], foo: [6], foo: [7] }; Select all the code in your region then run replace-regexp. For your regexp: you could use this: \([a-z]: +\[\)\([4-9]\|[1-90][0-9]\)\(\]\)...


2

If you install yasnippet and ac-go-expand-arguments-into-snippets is non-nil(Default is t) then argument snippet is expanded like following animation gif. company-mode provides such feature by itself, so you can use it without yasnippet by company-mode.


2

For basic help with indentation, use TAB and "C-M-q" (indent-pp-sexp); binding "C-m" to newline-and-indent will save you having to press TAB after a newline. You can navigate by sexp with "C-M-left/right/up/down/home/end", which is very useful. If you're worried about maintaining parenthesis balance, use something like smartparens (it's a bit more ...


Only top voted, non community-wiki answers of a minimum length are eligible