I'm editing python code using emacs, elpy and magit. When starting emacs using the -nw option (from bash and gnome-terminal in gnome 3). When started this way, emacs highlight the indented blocks of code using a black background single character; when using a graphic display (without the -nw option), the same character is a light gray. Please check out the two attached screenshots:
Is there a way to modify the darkness of the face in order make it less prominent?
I found a solutions that works. I'm not sure if it's the best one: if anybody knows a better way to do this, please comment!
In short:
Place the cursor on the indented block;
M-x customize-face;
Select the default value (highlight-indentation-face);
Select Show all (the face inherit from fringes);
Tick Background (this will overwrite the fringe background color);
Choose the white color (which is aliased to #e5e5e5)
Press Apply and Save
The last step will write few lines to the ~/.emacs file (on linux) to preserve the customization values. In my system, the lines that were added are:
(custom-set-variables)
(custom-set-faces
'(highlight-indentation-face ((t (:inherit fringe :background "white")))))
Related
I can't get emacs to scroll horizontally!
To replicate the problem:
Open the *scratch* buffer.
Write a long line.
Make the long line exceed the window width with M-xtoggle-truncate-lines. The left hand text (column 0) will now be off the left of the window.
Try M-xscroll-left or its shortcut C-x < to scroll left.
Type y to enable the disabled commands.
NOTHING HAPPENS!
I also tried C-a to go to the beginning of the line.
I also tried M-xtoggle-horizontal-scroll-bar but got the error message "Horizontal scroll bars aren't implemented yet".
There seems to be no way to scroll horizontally!
I need this because I have many wide CSV files to read.
I'm using the latest prelude on emacs 24.5 on Windows 10.
I filed an issue on the prelude project in case it is a genuine bug and could be fixed there.
You seem not to understand how horizontal scrolling works. It's not intuitive, that's why the command is disabled by default.
When I press C-x< at the end of the long line, the line disappears to the left. When I press C-x> there, nothing happens.
Pressing C-x< at the beginning of the long line, though, shows the second part of the long line.
Consider using visual-line-mode or even the csv-mode instead.
There is new a feature in Emacs 26. You can customize mwheel-tilt-scroll-p and use mouse to scroll.
M-x customize group RET mouse
Then set mwheel-tilt-scroll-p to t
No need to handroll it yourself. This is provided out of the box in emacs 27, and it probably was available for longer:
This feature is off by default; the variable mouse-wheel-tilt-scroll turns it on, if you customize it to a non-nil value.
(setq mouse-wheel-tilt-scroll t)
Sounds like xemacs have horizontal scroll in a 'natural' way.
As far as I can see it there is a [Options] button in the menubar, when clicking on it there is a [Frame Appearance] sub menu and there, there are 2 button []scrollbars, [] Truncate Lines
When these 2 buttons are checked in, long line are truncated and scrolling is smooth.
May be xemacs is non standard though.
I use it, I find it easy to cut/paste even rectangular areas, selection is faster and more precise to me that what I could achieve with keyboard meta-ctrl-shift stroke alone.
Cheers
Phi
I
I'm using emacs on a macbook. In linux, when I use C-SPC to start mark blocks, the area I marked has a yellowish background that tells me where I start & end. However, in my macbook the background is not highlighted, leaving me lost where the marked area is precisely sometimes. Can anyone tell me how to turn on the background color highlighting on a macbook?
You can do M-x transient-mark-mode to toggle the highlighting.
If you want it on by default, you can add (setq transient-mark-mode t) to your .emacs file.
When text is highlighted in vim, for example using the 'em' tag when writing a HTML document, I find that in some color schemes the cursor becomes invisible, making it difficult to correctly place the closing tag. Is there a way to have the cursor change color over highlighted text?
Change color of cursor in gvim
Look at both answers sir, I think you'll have your answer in there....
You'd have to hook into the CursorMoved,CursorMovedI events and then determine the highlight group under the cursor with synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name"). If it's one of those diffcult-to-see groups, you can issue a :highlight Cursor ... command to change it (or else change it back).
But this is rather complicated. Why don't you simply modify the colorscheme and choose a color that is easily recognized under all circumstances?! (The :hi command lists all colors and helps you choose one.)
This problem led me down quite a rabbit hole and caused me to learn a lot more about how syntax highlighting works than intended.
I learned that the reason my, supposedly italic, text was highlighted in the first place, is because the Mac terminal doesn't support italics ("Enabling italics in vim syntax highlighting for mac terminal")
I realised, thanks to "Colour colour everywhere! 256 colour-mode for Linux consoles", that due to the color profile I had chosen in Terminal's preferences, my "bright" and "normal" colors showed no difference, and for that reason my color profiles never looked like the screenshots.
And, finally, I solved my cursor getting lost problem by changing the cursor color in the Terminal preferences.
Emacs 23.1.1 Ediff 2.81.2 on CentOs 6
Prior to any customization, Ediff would, by default, split the windows horizontally (one on top of the other).
I wanted them side by side so I tried adding the following lines to my .emacs
(setq ediff-split-window-function 'split-window-vertically)
(setq ediff-merge-split-window-function 'split-window-vertically)
This had no effect - the windows were still split horizontally. I also tried using the Emacs Customization interface for Ediff to get the vertical split by default - same story.
Note that I tried this in a comparison with two buffers that were vertically split. I also tried it with no files open in buffers and asked Ediff to compare two files - same result.
Then I tried specifying split-window-horizontally as the split window function for both ediff-split and ediff-merge.
(setq ediff-split-window-function 'split-window-horizontally)
(setq ediff-merge-split-window-function 'split-window-horizontally)
This caused the windows to split vertically (next to each other). This was also true when I commented out these lines and used the Emacs Customization interface to set these options.
And yes, I've seen this question but I don't want to eliminate horizontal splitting on a global basis - I just want Ediff to do it by default.
Am I losing my mind or has someone switched the meaning of "horizontal" and "vertical" (and by the way, I'm taking the definition of "vertical" and "horizontal" splitting from my copy of the O'Reilly book "Learning Gnu Emacs")?
I used emacs variable customization, invoked with C-h v ediff-split-window-function to change the value. After clicking Save for future sessions the following was written to my .emacs:
(custom-set-variables
...
'(ediff-split-window-function (quote split-window-horizontally))
...)
And it does exactly what I want: putting the two buffers side-by-side. And yes, emacs uses horizontal/vertical in the opposite of what you had in mind.
If you read this question again, you will see the explanation, others were confused, too.
Hitting "|" when you are in ediff mode with the 2 files loaded switches from horizontal to vertical.
"?" gives a little ediff help menu.
(I'm on Debian Wheezy with emacs 23.4+1-4)
While it doesn't quite answer your problem, you could also use a function to specify whether to split vertically or horizontally depending on window dimensions:
(setq ediff-split-window-function 'split-window-sensibly)
split-window-sensibly is built-in.
In setting up my personal Linux command line development environment, I want to use term inside emacs b/c then I can switch to 'line mode' and copy/paste the output into any other buffer.
However, when I run mysql inside term inside emacs, the pretty sql tables still word wrap according to the width of that emacs window :(. I was hoping that emacs would truncate the bash output.
Is there a way to do this?
EDIT:
toggle-truncate-lines is on, so "word wrap" is off, but the problem is that before emacs even does anything with the text, the underlying bash process itself manually adds newlines to wrap text according to the width it's told it's using. That's at least how it acts. toggling truncate lines on/off doesn't change anything for me in the term buffer
I think what you probably want is "M-x toggle-truncate-lines". That toggles between wrapping or requiring you to scroll right and left to see the entire line.
You probably want to add something to the sql hook to turn off the wrapping:
(add-hook 'sql-interactive-mode-hook '(lambda () (toggle-truncate-lines 1))
I think Emacs might be setting the COLUMNS environment variable to indicate when the shell should wrap lines. Try setting it to a very large value and see if that helps.
I have no idea what other things this will break though.
Meta-X auto-fill-mode
This will toggle auto-fill mode and stop the line wrap.
The function term--unwrap-visible-long-lines is called by term-reset-size whenever the window is resized and appears to be responsible for the unwanted wrapping, and is not configurable. I hack this by advising the function to fix the wrapped width to a large value.
(defun my-prevent-term-unwrap (original-function height width)
(apply original-function (list height 10000)))
(advice-add 'term-reset-size :around 'my-prevent-term-unwrap)