help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting truncate-lines to true for all .log files


From: Johan Bockgård
Subject: Re: Setting truncate-lines to true for all .log files
Date: Wed, 12 Jul 2006 01:32:25 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"Ones Self" <oneself@gmail.com> writes:

> I'd like to have all *.log files have truncate-lines set to t, so
> lines will not wrap. How would I set something like that up?
>
> When I open a .log file in emacs it goes into fundamental mode. I
> could set it to go to a differerent mode using auto-mode-alist, but
> which mode? Do I need to create a new mode for this?

auto-mode-alist can contain any function, so you could get away with
this:

  (defun log-mode ()
    ;; You may want to call `fundamental-mode' or some other mode here
    (setq truncate-lines t))

  (add-to-list 'auto-mode-alist '("\\.log\\'" . log-mode))



If you want to make a proper mode:

  (define-derived-mode log-mode fundamental-mode "Log"
    ;; The mode runs `log-mode-hook', so you could use that instead.
    (setq truncate-lines t))

auto-mode-alist as above.

-- 
Johan Bockgård


reply via email to

[Prev in Thread] Current Thread [Next in Thread]