Hot answers tagged

38

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) ...


21

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 ?-...


15

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 ...


13

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 ...


12

Here's one way to do that: Add this to your init file: (defun hide-banner () (save-excursion (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 ...


8

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 ...


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 ...


7

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. Updated An alternative approach ...


7

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 ...


7

Prettify-symbols-mode comes with emacs; here's a blog post about it. You need to add the substitution to prettify-symbols-alist in whatever mode you want it in. Here's an example for javascript-mode: (add-hook 'javascript-mode-hook (lambda () (push '("function" . ?λ) prettify-symbols-alist))) and then M-x prettify-symbols-mode To avoid ...


7

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.


7

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: [[imghttp://tn-home.de/Pic/tn-home.png]]...


6

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+ ...


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

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 ...


5

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)...


5

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 =========================== Emacs ...


5

Function display-monitor-attributes-list gives you a list of the physical monitor attributes. This includes the display name (e.g., ".DISPLAY1"), which might be all you need. Dunno.


5

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) Kerning ...


5

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: (string-width "m") 1 (string-width "ハ") 1 (string-...


5

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 ...


4

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 ...


4

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: 1. http://sourceforge.net/projects/ezwinports/files/ -- leaner, more up-to-date builds, only for ...


4

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 emacs --daemon then when you want to edit a file, run emacsclient MYFILE or if you just want to create a frame, run emacsclient -c which will create an ...


4

Use display-pixel-width and display-pixel-height.


4

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. For example:


3

Yes. See pretty-symbols package. It can look like this, for example, when coding Python, or any other language:


3

Someone wrote a package that manages an overlay spanning the area after the end of the file: https://github.com/jmickelin/vim-empty-lines-mode 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.


3

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 ...


3

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 ...


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