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)
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 (see (info "(emacs) Minor Modes")).
For example, you can enable it in most programming language modes by adding ...
Here is one option which is more robust, it breaks almost nothing
(occasionally company-mode being a noteworthy exception), but is not as convenient
to mark the 80th column on the header.
Something like the following should suffice:
(list " " (make-string 79 ?-...
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:
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 ...
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 ...
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 ...
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
This EmacsWiki page is about Ruler Mode, a minor mode that shows a ruler for columns at the top of a window.
It also shows you the current column and the positions of comment-column, fill-column, goal-column, and the tab stops (as in tab-stop-list).
And this EmacsWiki page is about a ruler that pops up on demand, then disappears.
This other EmacsWiki page ...
You'll get used to it over time, but of course there's lots you can do to help speed it up:
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
This is misleading. 1 is ...
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
I can explain how I would go about making ...
You can turn on which-function-mode by doing
M-x which-function-mode RET
To make the setting permanent, add
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 ...
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:
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)
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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")
(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.)
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.
'action (lambda (b)
(with-current-buffer (button-get b '...
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 ...
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 ...
The docstring for re-search-forward says:
Search case-sensitivity is determined by the value of the variable
case-fold-search, which see.
Hence, you can set case-fold-search to t:
Non-nil if searches and matches should ignore case.
EDIT For font locking, you can set font-lock-keywords-case-fold-search to t:
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.
As an addition to what others have given as answers, here are my 2 cents:
The automatic indentation provided by emacs-lisp-mode is essential.
blink-matching-paren is on (non-nil) by default. Leave it so.
I use show-paren-mode, to highlight the left paren corresponding to the right paren before the cursor.
I temporarily delete and retype the right paren ...
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 ...