[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Erc-discuss] ERC thoughts, bugs, and wishlist
From: |
Ivan Shmakov |
Subject: |
Re: [Erc-discuss] ERC thoughts, bugs, and wishlist |
Date: |
Thu, 02 Oct 2014 06:43:51 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
>>>>> Kashish Sharma <address@hidden> writes:
[…]
> 3. Messages are split into multiple lines (similar to Auto Fill
> mode), timestamps appear in their own lines, and there is a blank
> line after each message. These add up to – needlessly IMHO – not
> just show a lot less information in the same area, but also to make
> it difficult to copy text from the scrollback and logs for the
> purposes of quoting etc. Wishlist – a nice touch would be the
> ability to customize how text is displayed – the order of placement
> of items (timestamp left, timestamp right, text, etc)
Be sure to check the erc-insert-timestamp-function,
erc-timestamp-format, erc-timestamp-format-left, and
erc-timestamp-format-right variables.
> as well as anything else the user wants (e. g. the extra newlines for
> those who like it the current way, which admittedly does look
> extra-neat and readable). And, with the same intent, a way to turn
> the ERC autofill on/off.
Personally, I’ve disabled erc-fill-mode and just use the Emacs
built-in ‘word-wrap’ facility instead, like:
;; NB: alternatively, use M-x customize-variable RET erc-modules RET
(eval-after-load 'erc
'(progn
(require 'cl) ; for remove-if
(setq erc-modules
(remove-if (lambda (x)
(memq x '(fill)))
erc-modules))))
(add-hook 'erc-mode-hook
(lambda ()
;; FIXME: turn this one into a minor mode?
(setq word-wrap t
wrap-prefix (make-string 4 ? ))))
Please note, however, that this results in the “right”
timestamps being printed on separate lines when the line
“payload” part is long enough (see erc-insert-timestamp-right.)
Other than that, – I see no “extra” newlines in my ERC buffers.
Presumably, this could be avoided by using the “left” timestamps
only. The proper solution might be to use window margins for
timestamps (and this way it will also adapt to the window width
changes, BTW), but I’m unsure if that’d play well with logging.
Just for the sake of completeness, here’s how I configure my
timestamps:
(setq erc-timestamp-format nil ; FIXME: see erc-add-timestamp
erc-timestamp-format-left "%Y-%m-%d %z\n"
erc-timestamp-format-right "%T")
[…]
> Syntax highlighting rules for ERC log files – something I've missed
> while reading logs. If I was more knowledgeable, I'd cook these up
> myself :\
FWIW, I’ve ended up with saving the logs in a text/enriched
format (MIMEd; see also enriched.el.) This doesn’t produce
exactly the same appearance when the log file is loaded back
into Emacs, but serves as a usable approximation.
Please note that since enriched-initial-annotation is suppressed
(otherwise the code may produce multiple such annotations in the
resulting log), the resulting log file will /not/ automatically
be decoded by Emacs. Instead, one may explicitly call the
my-erc-log-enriched-decode function (also MIMEd.)
[…]
--
FSF associate member #7257 np. На той стороне / На том берегу
http://boycottsystemd.org/ — Гражданская Оборона
(defun my-erc-log-enriched-filter (string)
(with-temp-buffer
(let ((inhibit-read-only t)
(inhibit-point-motion-hooks t) ; work-around for bug #18246
(paragraph-start "")
(paragraph-separate ""))
(insert string)
(use-hard-newlines 1 t)
(let ((last (+ -1 (point-max)))
(enriched-initial-annotation ""))
(if (not (eq ?\n (char-after last)))
(enriched-encode (point-min) (point-max) nil)
(enriched-encode (point-min) last nil)
(insert ?\n))))
;; .
(buffer-substring-no-properties (point-min) (point-max))))
(defun my-erc-log-enriched-decode (&optional from to)
(interactive "r")
(let ((inhibit-read-only t)
(inhibit-point-motion-hooks t)) ; NB: not strictly necessary
;; parts of enriched-decode (lisp/textmodes/enriched.el)
(format-deannotate-region (point-min) (point-max)
enriched-translations
'enriched-next-annotation)
(while (search-forward-regexp "\n\n+" nil t)
(if (current-justification)
(delete-char -1))
(set-hard-newline-properties (match-beginning 0) (point)))))
(setq erc-log-filter-function
'my-erc-log-enriched-filter)