Find the answer to your Linux question:
Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By masinick
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, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25

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

  2. #2
    Linux Newbie
    Join Date
    Apr 2005
    Location
    Clinton Township, MI
    Posts
    103
    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.

    Example:
    (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

    global-visual-line-mode
    Last edited by masinick; 12-27-2012 at 12:21 AM. Reason: additional information
    StupidUser likes this.

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25
    Quote Originally Posted by masinick View Post
    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.

    Example:
    (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

    global-visual-line-mode
    Works perfectly. Ty.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •