From: Zachary Kanfer <zkanfer@gmail.com>
To: 10734@debbugs.gnu.org
Subject: bug#10734: Proposal: comint-history-read-only
Date: Mon, 6 Feb 2012 02:31:59 -0500 [thread overview]
Message-ID: <CAFXT+RPEyTjdO9Xn47QTYii3u5QkyODpLVBgDGBSB0uNzL4+ag@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 401 bytes --]
This patch proposes a new feature in comint mode. Currently, setting
comint-prompt-read-only to some non-nil value makes the prompt read-only,
but this only makes the prompt read-only. I don't find it useful to insert
text into the middle of a historical buffer, so I added a new variable
comint-history-read-only. If set to non-nil, this variable makes the entire
history read-only.
-Zachary Kanfer
[-- Attachment #1.2: Type: text/html, Size: 420 bytes --]
[-- Attachment #2: comint-history-read-only-2012-02-06.txt --]
[-- Type: text/plain, Size: 2329 bytes --]
=== modified file 'lisp/comint.el'
*** lisp/comint.el 2011-11-20 07:30:16 +0000
--- lisp/comint.el 2012-02-06 07:25:40 +0000
*************** you might wish to use another binding fo
*** 194,199 ****
--- 194,204 ----
:group 'comint
:version "22.1")
+ (defcustom comint-history-read-only nil
+ "If non-nil, all comint history is read only."
+ :type 'boolean
+ :group 'comint)
+
(defvar comint-delimiter-argument-list ()
"List of characters to recognize as separate arguments in input.
Strings comprising a character in this list will separate the arguments
*************** Make backspaces delete the previous char
*** 2022,2035 ****
(let ((prompt-start (save-excursion (forward-line 0) (point)))
(inhibit-read-only t)
(inhibit-modification-hooks t))
! (when comint-prompt-read-only
! (or (= (point-min) prompt-start)
! (get-text-property (1- prompt-start) 'read-only)
! (put-text-property
! (1- prompt-start) prompt-start 'read-only 'fence))
! (add-text-properties
! prompt-start (point)
! '(read-only t rear-nonsticky t front-sticky (read-only))))
(unless (and (bolp) (null comint-last-prompt-overlay))
;; Need to create or move the prompt overlay (in the case
;; where there is no prompt ((bolp) == t), we still do
--- 2027,2043 ----
(let ((prompt-start (save-excursion (forward-line 0) (point)))
(inhibit-read-only t)
(inhibit-modification-hooks t))
! (cond (comint-history-read-only
! (add-text-properties (point-min) (point)
! '(read-only t front-sticky (read-only))))
! (comint-prompt-read-only
! (or (= (point-min) prompt-start)
! (get-text-property (1- prompt-start) 'read-only)
! (put-text-property
! (1- prompt-start) prompt-start 'read-only 'fence))
! (add-text-properties
! prompt-start (point)
! '(read-only t rear-nonsticky t front-sticky (read-only)))))
(unless (and (bolp) (null comint-last-prompt-overlay))
;; Need to create or move the prompt overlay (in the case
;; where there is no prompt ((bolp) == t), we still do
next reply other threads:[~2012-02-06 7:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 7:31 Zachary Kanfer [this message]
2016-02-24 6:44 ` bug#10734: Proposal: comint-history-read-only Lars Ingebrigtsen
2019-06-27 15:32 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFXT+RPEyTjdO9Xn47QTYii3u5QkyODpLVBgDGBSB0uNzL4+ag@mail.gmail.com \
--to=zkanfer@gmail.com \
--cc=10734@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).