Increase line height in Spacemacs - emacs

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.

Related

How easily change font size in spacemacs?

How do change the font size in spacemacs? Do I need to download additional packages such as source code font?
I tried changing the font size in the configuration file, but the font size does not change. I am having trouble installing source code font, because the font paths are not registered correctly. The fonts were installed via the instructions provided by open source Adobe. Is there an easier way to do such a simple task in spacemacs?
Another way is to use the key sequence "SPC z x" and then press "+/=" key to increase font size or "-" key to decrease font size. Other options are shown on the which-key menu.
In my .spacemacs file I have the following
(defun dotspacemacs/init ()
(setq-default
dotspacemacs-startup-lists '(recents bookmarks projects)
dotspacemacs-default-font '("SourceCode Pro"
:size 18
:weight normal
:width normal
:powerline-offset 2))
Of course you should change the font to your liking. The powerline has some char that goes well with the powerline in spacemacs.
To get to .spacemacs simply type SPC f e d to reload the new file type SPC f e R.
This should do it.
And yes I am an old man with less than optimal eyes, hence the rather large font.
If you don't want to change the default settings or want to change the font size without restarting emacs, try:
M-x text-scale-increase
Another way I do it (at least in Ubuntu 20.04) is to click CTRL and move the scroll wheel on your mouse or touchpad to increase/decrease the size of the text.

Set column width for visual lines in Emacs

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.

Emacs word wrap at a specific column number

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.

Altering the font size for the Emacs minibuffer separately from default emacs?

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.

is it possible to move the emacs minibuffer to the top of the screen?

I've started coding on a 30 inch monitor and am wondering if it's possible to move the minibuffer to the top of the screen in emacs? google searches aren't showing up anything.
Cheers
Nimai Etheridge
Have a look at the documentation for the default-minibuffer-frame and initial-frame-alist vars. It sounds like you may be able to have a separate frame for your minibuffer (which you could position at the top of the screen), and then generate minibufferless frames which utilise it.
Note that in initial-frame-alist it states that "If the value calls for a frame without a minibuffer, and you have not created a minibuffer frame on your own, a minibuffer frame is created according to minibuffer-frame-alist", which sounds like exactly what would be needed.
There are ways of saving and restoring frame configurations, so if this worked you could probably recreate the layout automatically when emacs starts.
Edit:
Very basic example/proof-of-concept below for using this frame arrangement. The minibuffer frame can't be deleted until the frames utilising it have been deleted. You'll run into trouble when you do things like maximising the editor frame, of course, so there would certainly be some work to do to try to make this system work in a more seamless fashion.
(setq default-minibuffer-frame
(make-frame
'((name . "minibuffer")
(width . 80)
(height . 1)
(minibuffer . only)
(top . 0)
(left . 0)
)))
(setq new-frame
(make-frame
'((name . "editor")
(width . 80)
(height . 30)
(minibuffer . nil)
(top . 50)
(left . 0)
)))
Naturally, you can also combine this with scottfrazer's method of moving the modeline to the top.
This could possibly be handled in the window-setup-hook?
You should also look at the built-in frame.el and dframe.el libraries. Functions like dframe-reposition-frame may provide a convenient way of keeping the minibuffer frame 'attached' to the top of the active editing frame.
The variable minibuffer-auto-raise can also be configured to raise the minibuffer frame whenever the minibuffer is activated, which may mitigate the need to have it visible the rest of the time.
I'm pretty sure you can't move the minibuffer itself, but you can sort-of-ish make the mode line be on top:
(setq-default header-line-format mode-line-format) ; Copy mode-line
(setq-default mode-line-format nil) ; Remove mode-line
This will override things like Info that use the header line, but it's probably as close as you'll get without hacking C source.
Use a standalone minibuffer frame. This shows how:
http://www.emacswiki.org/emacs/Dedicated_Minibuffer_Frame
http://www.emacswiki.org/emacs/oneonone.el
Either look at that code to get an idea or just use it directly. You need only customize the minibuffer frame position settings:
1on1-minibuffer-frame-left -- Position of left edge of minibuffer frame, in pixels.
1on1-minibuffer-frame-top/bottom -- Position of top (or bottom) of minibuffer frame, in pixels.
After being stuck on these answers for a good while, I discovered clemera's answer for emacs 26+ to be useful:
For Emacs 26 and later you can use emacs-maple-minibuffer or ivy-posframe if your are using ivy.
Those packages let you configure to popup a minibuffer frame at any position, including the current window top/bottom. The docs of those packages describe how to set them up.