From cd80739e8f224e9ba28351fddff5538e31877f13 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 5 Feb 2020 16:39:44 +0100 Subject: [PATCH] Emacs: Truncate lines only in prog-mode and conf-mode. --- init.d/basics/buffers.el | 10 +++++++++- init.d/programming/common.el | 6 +----- init.d/text/common.el | 4 +--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/init.d/basics/buffers.el b/init.d/basics/buffers.el index 0b3e1e5..3c29909 100644 --- a/init.d/basics/buffers.el +++ b/init.d/basics/buffers.el @@ -1,6 +1,6 @@ ;;; buffers.el --- Default settings for buffers. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-02-02T10:16:51+0100> +;; Time-stamp: <2020-02-05T16:35:38+0100> ;;; Commentary: ;; * Setup scratch buffer. @@ -40,10 +40,18 @@ (set-frame-parameter nil 'buffer-predicate 'my/buffer-predicate) + (defun my/truncate-lines () + "Truncate lines instead of wrapping them." + (setq-local truncate-lines t)) + :bind ;; Switch buffers. ("M-" . previous-buffer) ("M-" . next-buffer) + + :hook + (prog-mode . my/truncate-lines) + (conf-mode . my/truncate-lines) ) ;; Show and select buffers. diff --git a/init.d/programming/common.el b/init.d/programming/common.el index 008830b..4896691 100644 --- a/init.d/programming/common.el +++ b/init.d/programming/common.el @@ -1,6 +1,6 @@ ;;; common.el --- Common programming settings. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-02-04T18:49:51+0100> +;; Time-stamp: <2020-02-05T16:32:28+0100> ;;; Commentary: @@ -19,10 +19,6 @@ tab-width 4) (electric-pair-mode t) ; Auto-type closing brackets. - :hook - ;; Wrap long lines in compilation output. - (compilation-mode . (lambda () (setq-local truncate-lines nil))) - :bind ;; Switch between header and implementation. ("C-:" . ff-find-other-file) diff --git a/init.d/text/common.el b/init.d/text/common.el index 79ea32d..504b400 100644 --- a/init.d/text/common.el +++ b/init.d/text/common.el @@ -1,6 +1,6 @@ ;;; common.el --- Common settings for text files. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-01-27T04:33:20+0100> +;; Time-stamp: <2020-02-05T16:31:25+0100> ;;; Commentary: @@ -15,8 +15,6 @@ (require-final-newline t) ; Always add newline at end of file. (fill-column 80) ; Documents are 80 chars wide by default. (word-wrap t) ; Wrap at word for continuation lines. - (truncate-line t) ; No continuation lines. - (truncate-lines t) ; The same? :bind ("C-r" . jump-to-register) ; Move point to location in register.