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)
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:
Emacs comes with elide-head.el which does exactly what you're asking for.
To use it, add elide-head to a major mode hook or find-file-hook (in your case c-mode-common-hook should work). It can hide GPL license comments out of the box; to hide other lengthy headers, customize elide-head-headers-to-hide.
Note that it does not hide just any comment at the top ...
Here's one way to do that:
Add this to your init file:
(defun hide-banner ()
(let* ((start (progn (beginning-of-buffer) (point)))
(end (progn (forward-comment (buffer-size)) (point)))
(over (make-overlay start end)))
(overlay-put over 'invisible t))))
In the buffer where you want to hide the initial ...
emacs for now doesn't support ligatures (on OSX there is some support, but not on other platforms).
However, emacs 24.4+ supports prettify-symbols-mode which in some ways is better than normal ligatures support.
That mode allows to subsitute for display any regex with any glyph. I am personnally using this snippet to get Fira Code ligatures to work in emacs ...
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 ...
You can customize indicate-empty-lines to enable a fringe marker on lines after the end of the file, or call toggle-indicate-empty-lines to turn it on and off interactively.
There's a package on MELPA that replaces the default fringe indicator with a ~ for a look that is closer to what you get with vi. See vi-tilde-fringe.
An alternative approach ...
I don't use Emacs on Windows, nor do I use xwidgets, but I do know that Emacs has to be compiled with xwidgets (since some of its stuff is written in C) for it to work. Taking a cursory look at the configure options for Emacs, I see a particular option for compiling Emacs with xwidgets:
--with-xwidgets enable use of some gtk widgets in Emacs buffers
(push '("function" . ?λ) prettify-symbols-alist)))
and then M-x prettify-symbols-mode
To avoid ...
edit: With Emacs 26.1 or later, it's a (setq display-raw-bytes-as-hex t) away.
No, you can't. The display of unprintables above the printable ASCII range is hardcoded in xdisp.c:
if (CHAR_BYTE8_P (c))
/* Display \200 instead of \17777600. */
c = CHAR_TO_BYTE8 (c);
len = sprintf (str, "%03o", c + 0u);
I sent a patch fixing this to debbugs.
And again we have a use-case for image data not stored on harddisk.
(The other two use-cases are base64 encoded images in org buffers and displaying previews of youtube videos.)
Get org-yt and paste the following elisp code into your init-file.
After evaluating your init-file you can use links analog to the example:
In the release log of emacs:(http://www.gnu.org/software/emacs/news/NEWS.24.5)
* Installation Changes in Emacs 24.3
** The default X toolkit is now Gtk+ version 3.
If you don't pass `--with-x-toolkit' to configure, or if you use
`--with-x-toolkit=gtk' or `--with-x-toolkit=yes', configure will try
to build with Gtk+ version 3, and if that fails, try Gtk+ ...
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)
What you want to do is to set the display-table entry for character LEFT-TO-RIGHT EMBEDDING to the glyph that is used for character SECTION SIGN.
(aset (or (window-display-table) standard-display-table)
8234 ; 0x202A, which is the char LEFT-TO-RIGHT EMBEDDING
(vector (make-glyph-code ?§)))
If the selected window has its own display table, then ...
To expand on Tarsius' answer.
display-pixel-width and display-pixel-height return the width and height respectively.
display-monitor-attributes-list will give you information on all the available monitors attached to the DISPLAY. If you're dealing with a multi-monitor situation you'll probably need:
(assq 'workarea (nth X (display-monitor-attributes-list)...
Are there any better alternatives?
Emacs 27 will support 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 (emacs) Displaying Boundaries:
14.15 Displaying Boundaries
A trick that can work is to edit a variable-width font to adjust the bounding boxes of its characters, effectively making it monospace. There are some caveats:
The exact width depends on which monospace font one wants to use it with.
Wide characters will bleed a bit onto neighbouring spaces (though they can be slightly shrunk to mitigate the issue)
This depends on the fonts you are using. And I don't think Elisp has pixel level alignment capability.
Org calculate width of string with string-width instead of length. string-width returns 1 for ASCII and Half width CJK chars or 2 for Full width chars. Evaluate the following code will show you that:
I figured it out thanks to the answer by Gilles and the 2010/2011 thread on gnu.emacs.help called “How switch from escaped octal character code to escaped HEX?” (Google Groups, Nabble).
The details of how Emacs displays characters are in the section Display > Text Display (“How Text Is Displayed”) of the Emacs manual (C-h r), and section Display > Character ...
I'm sorry to say that this seems to be entirely impossible in Emacs currently. From Line Height (emphasis mine):
The total height of each display line consists of the height of the contents of the line, plus optional additional vertical line spacing above or below the display line.
The height of the line contents is the maximum height of any ...
The problem lies in the self compiled libjpeg-9.dll. It is solved by downloading dll files from ezwinports as recommended:
Emacs can also support some other image formats with appropriate
libraries. These libraries are all available on the following sites:
-- leaner, more up-to-date builds, only for ...
Since Emacs 23, you no longer need to care whether Emacs was started from inside X. Start Emacs however you like, possibly as a daemon. Open and close frames on any display as desired.
Start Emacs with
then when you want to edit a file, run
or if you just want to create a frame, run
which will create an ...
I've written a package, char-font-lock, that (among else) highlight empty lines at the end of a buffer.
It also highlights the last line (in case it doesn't end with a newline), space at the end of lines, tab characters, and non-ascii characters. You can cherry pick which of the things you would like to highlight.
Someone wrote a package that manages an overlay spanning the area after the end of the file:
Keep in mind though that while this solution behaves more correctly and works in terminals as well, it will necessarily be less performant and more buggy than the fringe indicator one.
You might try this:
Whenever a frame is selected (e.g. advise relevant functions), you update a frame parameter on that frame with a timestamp value.
It should then be easy (dunno about performance) to check the frame list for a given display (or whatever), to either look for the most recent frame or to sort the frames.
If this is unclear, let me know and ...
It's not super clear what behavior you're looking for.
If you want Emacs to either (1) replace the current buffer in the selected window or (2) show the new buffer in a new frame instead of a new window in the same frame, then consider using non-nil pop-up-frames.
In that case, you will likely want to make some additional changes, because Emacs development ...