Note that as of Emacs 27, you should probably use the built-in display-fill-column-indicator-mode, as noted by the newer answer from Basil.
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 ...
Are there any better alternatives?
Emacs 27 (officially released 2020-08-11) 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 ...
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 ...
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:
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
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.
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 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 ...
(push '("function" . ?λ) prettify-symbols-alist)))
and then M-x prettify-symbols-mode
To avoid ...
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 ...
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)
There is a mode for that: centered-cursor-mode. It can be installed from MELPA.
It does not play well with a couple of modes, so this is my configuration:
;; keep the cursor centered to avoid sudden scroll jumps
;; disable in terminal modes
;; also disable in Info mode, because ...
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 ...
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)
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)...
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:
The built-in line numbering mechanism uses the text-area that is sandwiched between the left/right fringes and/or left/right margins, to the extent that fringes/margins exist. [What happens internally is that the line number glyphs (with a space on each end) are prepended to the glyphs of the display line within the text area.] Thus, setting the fringe or ...
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.
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 ...
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 ...
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.