Emacs automatically wraps the line when a certain margin is reached. This margin also applies for the M-q (realign paragraph) command. This margin seems to be around 70 characters. How do I increase this margin?
In general, the variable fill-column controls the column number at which certain modes automatically insert a hard-return -- aka \n -- when typing a long line. To the extent that the fill-column is set prior to the margin, the margin setting is irrelevant. To read more about the fill-column, type M-x describe-variable RET fill-column RET
Emacs has built-in support for word-wrap (when said variable is set to t), which wraps whole words for long lines that reach the window edge/fringe/margin -- without inserting hard-returns. This is different than the concept/mechanism discussed above.
Related
I'm intending to increase the height of each line in Spacemacs. I tried to put some code into user-config block in the .spacemacs file in my home directory like below, but the line height doesn't change at all:
(defun dotspacemacs/user-config ()
'(add-text-properties (point-min) (point-max)
'(line-spacing 0.25 line-height 1.25))
)
Does anyone know how to do this in Spacemacs? I have just started to use Spacemacs for a week so I'm totally a newbie.
In addition to the other answers, you can the emacs UI to customize the vertical spacing. You do this by:
1. M-x
2. Type customize variable then press enter
3. Type line-spacing then press enter
You'll be taken to a UI menu for customizing the line spacing variable.
On the line that says line spacing, go to the button that says value menu, press enter, press 1 to use a custom value. Then in the box to the right, you can change the value from 0.0 to whatever you'd like!
Then make sure to hit the save and apply button!
After a while searching for the solution, I found out that there are lots of tricks to do to increase the line height, while keeping the text appearing at the center of the line. So I tried to modify the font instead using FontForge (increase the top and bottom space of the font).
For people who may want to achieve the same thing, I'd like to say that using FontForge to create a new font that suit you is far easier than finding a way to do it via configuration in Spacemacs.
Just for information, evaluating (setq line-spacing 2) in a buffer increases the line spacing.
You can add (setq-default line-spacing 2) to your .emacs file to change it globally. setq wouldn't work because line-spacing is a buffer-local variable.
I have my emacs fill-column set to almost 10 trillion (999999999999). Is that bad, or is there another way to make emacs have a virtually infinite fill-column?
What is the use of a fill-column anyways? Why would one want that sort of line wrapping?
Yes, you can have a gigantic fill-column. Or yes, you can turn off auto-fill-mode (use (auto-fill-mode -1) or set auto-fill-function to nil).
"That sort of line wrapping" is useful if you want text that has lines of limited length. (Duh.)
See also visual-line-mode, which can give you a similar visual effect but without the insertion of hard newlines.
Is there an equivalent to the fill-column variable for the "Wrap" mode (visual-line-mode) in Emacs? If not, how could I set a limit on the length of visual lines when the window/frame of the buffer is wider ?
In response to this question I created a minor mode called window-margin that accomplishes what #Stefan suggested in his answer.
Turn on window-margin-mode with:
(add-hook 'text-mode-hook 'turn-on-window-margin-mode)
The way you can still do it without installing window-margin is to use the longlines-mode that ships with Emacs, but is being phased out since there are some problems with longlines-mode, but here's the old way to do it if you want:
Turn on longlines-mode with something like:
(add-hook 'text-mode-hook 'longlines-mode)
which wraps text at the fill-column.
longlines-mode has been removed. For visual-line-mode, the simplest way is to make the window as narrow as you want it to be. You can do that with C-x 3 and then adjusting the size of the window. Or you can set a wide margin or wide fringes.
I like to run my editor full-screen. The only thing is, though, that when I do this, the word wrap only kicks in when the line hits the right edge of the screen. I would like it to do so, already when the line hits, say, column number 200.
How do I do that?
I would like it to happen in all modes, e.g., Org-mode. I added the line (global-visual-line-mode t) to my .emacs file, in order for the word wrapping also to work in org-mode.
I'm running Emacs 23.
I got it working! Here is what I added to my .emacs file to make it happen:
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook
'(lambda() (set-fill-column 80)))
Type M-x auto-fill-mode to activate automatic line-wrapping after a certain column. Then set the actual line width through the variable fill-column as described by user choroba (C-x f).
Note though that this works a bit differently from what other text editors do. M-q will re-format the current paragraph.
You can set the line width with C-xf (set-fill-column).
Afterwards, you might need to hit M-q to reformat the current paragraph (fill-paragraph), or select text to be justified and run fill-region.
The suggestion for turn-on-auto-fill will work if you want hard newlines in the files you're editing. If not, and you just want word-wrap, consider instead visual-fill-column-mode, which just does the normal word-wrap that would happen at the edge of the window, but at the specified fill-column.
See the Emacs manual (C-h r), node Filling. See in particular the first subnode in the menu, Auto Fill.
I've been attempting to alter the font / face for the emacs minibuffer separately from emacs default fonts, but without much luck.
Specifically, I'm interested in making the minibuffer font size larger for use with the emacs MULE as, with my current font setting or if I'm using emacs on a "netbook" screen, sometimes the character selection options in the MULE are a bit small.
Options easily accessed within emacs are the minibuffer-prompt & minibuffer-prompt-properties, but these are only for command prompts and not the regular minibuffer text.
There seem to be a number of minibuffer variables listed in emacs for creating minibuffer frames, or getting contents from minibuffer windows, etc.. but these do not pertain to altering the minibuffer face. Is it even possible to alter the minibuffer face separately from the default emacs?
An interesting option is the oneonone emacs http://www.emacswiki.org/emacs/OneOnOneEmacs project. But could the dedicated minibuffer frame be altered? Also before I alter my current emacs set-up that drastically, I'd hope to be able to just alter fonts first or create my own alterable minibuffer frame, etc...
Any help and/or creative ideas would be greatly appreciated.
You can add customization to the minibuffer through the minibuffer-setup-hook. In there, you can do some face remapping like so:
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup)
(defun my-minibuffer-setup ()
(set (make-local-variable 'face-remapping-alist)
'((default :height 2.0))))
Change the body of the my-minibuffer-setup as desired. The above doubles the height of the default face.
Yes, you can easily customize the properties of a standalone minibuffer frame, including its default face and font.
You can customize the OneOnOneEmacs user option 1on1-minibuffer-frame-alist. (Or you can customize the standard option minibuffer-frame-alist -- its frame parameter values are used as defaults by 1on1-minibuffer-frame-alist.)
The font frame parameter is the one that controls the font (duh). So you would customize option 1on1-minibuffer-frame-alist, changing its setting for the font.
Alternatively, you can just set 1on1-minibuffer-frame-font to the font you want -- it is used as the default value for the font setting by 1on1-minibuffer-frame-alist whenever there is no explicit font setting in minibuffer-frame-alist. For example:
(setq 1on1-minibuffer-frame-font
"-*-Lucida Console-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
If you do not want to use a standalone minibuffer frame then see Trey's answer.