Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-25-2012 #1
- Join Date
- Jul 2010
How can I auto enable toggle-truncate-lines in emacs?
Whenever I start emacs, the first thing I do is enable toggle-truncate-lines (M-x tog<tab>tr<tab><enter>).
Is it possible to make this the default setting? If so, how?
Kindly keep your answers easy enough for someone who knows very little about Linux and emacs to understand (if possible).
- 12-27-2012 #2
- Join Date
- Apr 2005
- Clinton Township, MI
From the Emacs documentation:
14.21 Line Truncation
As an alternative to continuation (see Continuation Lines), Emacs can display long lines by truncation. This means that all the characters that do not fit in the width of the screen or window do not appear at all. On graphical displays, a small straight arrow in the fringe indicates truncation at either end of the line. On text terminals, this is indicated with ‘$’ signs in the leftmost and/or rightmost columns.
Horizontal scrolling automatically causes line truncation (see Horizontal Scrolling). You can explicitly enable line truncation for a particular buffer with the command M-x toggle-truncate-lines. This works by locally changing the variable truncate-lines. If that variable is non-nil, long lines are truncated; if it is nil, they are continued onto multiple screen lines. Setting the variable truncate-lines in any way makes it local to the current buffer; until that time, the default value, which is normally nil, is in effect.
If a split window becomes too narrow, Emacs may automatically enable line truncation. See Split Window, for the variable truncate-partial-width-windows which controls this.
Translating this, if you want to have lines truncated, then create a variable in the file .emacs called truncate-lines. IF it is nil the lines are continued, wrapped onto multiple lines, but if there is a non-zero, non-nil value to this variable, then lines that exceed the width either implied or explicitly specified will be truncated.
(set-default 'truncate-lines t)
Put this in your .emacs file, and put the .emacs file in your home directory, (~).
Alternatively, if you are running a recent version of GNU Emacs, You can also change this from the menu.
Options->Line Wrapping in this Buffer->Truncate Long Lines
Or if you want this globally you can use the function
Last edited by masinick; 12-27-2012 at 12:21 AM. Reason: additional information
- 01-15-2013 #3