all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#10734: Proposal: comint-history-read-only
@ 2012-02-06  7:31 Zachary Kanfer
  2016-02-24  6:44 ` Lars Ingebrigtsen
  2019-06-27 15:32 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Zachary Kanfer @ 2012-02-06  7:31 UTC (permalink / raw)
  To: 10734


[-- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#10734: Proposal: comint-history-read-only
  2012-02-06  7:31 bug#10734: Proposal: comint-history-read-only Zachary Kanfer
@ 2016-02-24  6:44 ` Lars Ingebrigtsen
  2019-06-27 15:32 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  6:44 UTC (permalink / raw)
  To: Zachary Kanfer; +Cc: 10734

Zachary Kanfer <zkanfer@gmail.com> writes:

> 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.

I think this probably makes sense...  Most process oriented mode are
quite read-only, except for the line you're typing on.

> + (defcustom comint-history-read-only nil
> +   "If non-nil, all comint history is read only."
> +   :type 'boolean
> +   :group 'comint)

This might even default to t?

It needs updating in the Emacs manual and an etc/NEWS entry, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#10734: Proposal: comint-history-read-only
  2012-02-06  7:31 bug#10734: Proposal: comint-history-read-only Zachary Kanfer
  2016-02-24  6:44 ` Lars Ingebrigtsen
@ 2019-06-27 15:32 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-27 15:32 UTC (permalink / raw)
  To: Zachary Kanfer; +Cc: 10734

Zachary Kanfer <zkanfer@gmail.com> writes:

> + (defcustom comint-history-read-only nil
> +   "If non-nil, all comint history is read only."
> +   :type 'boolean
> +   :group 'comint)

Nobody had any opinion about this when I brought this up three years
ago, so I think the feeling may be that this isn't worth adding a new
variable for, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-27 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06  7:31 bug#10734: Proposal: comint-history-read-only Zachary Kanfer
2016-02-24  6:44 ` Lars Ingebrigtsen
2019-06-27 15:32 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.