From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Feedback on getting rid of `term-suppress-hard-newline' Date: Wed, 16 Jan 2019 11:51:50 -0500 Message-ID: References: <87efanc576.fsf@gmail.com> <87sgxsr8p0.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1547657549 15128 195.159.176.226 (16 Jan 2019 16:52:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Jan 2019 16:52:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 16 17:52:25 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gjoQR-0003nr-Ew for ged-emacs-devel@m.gmane.org; Wed, 16 Jan 2019 17:52:23 +0100 Original-Received: from localhost ([127.0.0.1]:46208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjoSY-0005k5-BC for ged-emacs-devel@m.gmane.org; Wed, 16 Jan 2019 11:54:34 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjoQ7-00050j-7q for emacs-devel@gnu.org; Wed, 16 Jan 2019 11:52:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjoQ6-00060T-JL for emacs-devel@gnu.org; Wed, 16 Jan 2019 11:52:03 -0500 Original-Received: from [195.159.176.226] (port=57611 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjoQ6-0005zy-BQ for emacs-devel@gnu.org; Wed, 16 Jan 2019 11:52:02 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gjoNv-0000JU-TI for emacs-devel@gnu.org; Wed, 16 Jan 2019 17:49:47 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:IV9KjBM8vA3BH2qEu+uYer1CPD8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232399 Archived-At: > ping FWIW, I think this makes a lot of sense, so please go ahead. A few comments below, Stefan >> @@ -1106,6 +1106,7 @@ term-mode >> (make-local-variable 'term-scroll-show-maximum-output) >> (make-local-variable 'term-ptyp) >> (make-local-variable 'term-exec-hook) >> + (setq-local filter-buffer-substring-function 'term-filter-buffer-substring) Please use `add-function` to modify filter-buffer-substring-function. >> + (put-text-property old-point (point) 'term-newline t))) I'd recommend you use a more explicit name which doesn't just state the obvious "this is a newline in term mode". E.g. something like `term-wrap-newline`. >> + (let (buffer-read-only) >> + (delete-char 1)))) Never let-bind `buffer-read-only`: let-bind `inhibit-read-only` instead. >> + ;; delete all fake newlines Please capitalize and punctuate your comments. >> + (when (> len width) >> + (goto-char (+ bol width)) Not sure how well term deals with wide chars (e.g. TAB or chinese chars), but this code of yours clearly won't help. I think you want to test current-column rather than `len` and then you want move-to-column rather than advancing by N chars.