* Patch to term.el
@ 2007-08-05 13:31 Richard Stallman
2007-08-05 14:14 ` Vinicius Jose Latorre
0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2007-08-05 13:31 UTC (permalink / raw)
To: emacs-devel
Would someone please install this patch (a tiny change)
in Emacs 22? It is a tiny change.
Date: Mon, 23 Jul 2007 12:22:56 -0700 (PDT)
From: Peter Povinec <pp_publiclists@yahoo.com>
To: Dan Nicolaescu <dann@ics.uci.edu>
In-Reply-To: <200707021728.l62HSpEj014971@oogie-boogie.ics.uci.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Message-ID: <831335.3790.qm@web57313.mail.re1.yahoo.com>
X-detected-kernel: FreeBSD 6.x (1)
X-Mailman-Approved-At: Mon, 23 Jul 2007 16:43:41 -0400
Cc: bug-gnu-emacs@gnu.org
Subject: Re: Setting term-default-fg-color/term-default-bg-color has no
effect
X-BeenThere: bug-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GNU Emacs,
the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
Errors-To: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4)
> Can you please describe exactly what are you doing and how? How did
> you test your patch?
The basic idea is the same as it was in Emacs 21. Take the user preferences
in terms of fg/bg colors as stored in term-default-fg-color and
term-default-bg-color and apply them consistently every time term-current-face
is set. This is done for the initial value of term-current-face, when the
terminal is reset in term-reset-terminal, and when the escape sequences
setting the default fg/bg colors are interpreted in term-handle-color-array.
Note that this was partially done already in term-handle-color-array, e.g. in
the case of setting reverse+invisible.
For the testing, I've tested with my color customizations, including colored
terminal prompt in csh. I verified the reverse video logic by running 'top'
and 'emacs -nw' inside an ansi-term, both with my customizations, and plain
emacs. Customizations to term-default-fg-color or term-default-bg-color while
one or more term sessions are running take effect as expected, e.g. by running
'reset'.
> >
> > ! (defcustom term-default-fg-color (face-foreground term-current-face)
> > "Default color for foreground in `term'."
> > :group 'term
> > :type 'string)
> >
> > ! (defcustom term-default-bg-color (face-background term-current-face)
> > "Default color for background in `term'."
> > :group 'term
> > :type 'string)
>
> This can't be right, term-current-face is nil when term.el is
> loaded...
See line 462 (in revision 1.89):
(defvar term-current-face 'default)
I'd agree the code would be easier to read if this line was moved, but as I
mentioned I didn't want to do any unnecessary changes to keep this a tiny
patch.
> > + ;;; Start with requested fg/bg.
> > + (setq term-current-face (list :background term-default-bg-color
> > + :foreground term-default-fg-color))
>
> We don't want forms that have side effects at the top level...
Moved to (term-mode) now.
The updated patch is below.
HTH,
--Peter
2007-07-23 Peter Povinec <ppovinec <at> yahoo.com>
* term.el: Honor term-default-fg-color and term-default-bg-color
settings when modifying term-current-face.
(term-default-fg-color, term-default-bg-color): initialized from
default term-current-face
(term-mode, term-reset-terminal): set term-current-face with
term-default-fg-color and term-default-bg-color
(term-handle-colors-array): term-current-face has term-default-fg-color
and term-default-bg-color after reset escape sequence
(term-handle-colors-array): set term-current-color with
term-default-fg/bg-color instead of ansi-term-color-vector when the
index (term-ansi-current-color or term-ansi-current-bg-color) is zero
*** /home/ppovinec/term.el.orig 2007-06-24 01:04:07.298996000 -0700
--- /home/ppovinec/term.el 2007-07-23 12:18:01.418489000 -0700
***************
*** 695,706 ****
;;; faces -mm
! (defcustom term-default-fg-color 'unspecified
"Default color for foreground in `term'."
:group 'term
:type 'string)
! (defcustom term-default-bg-color 'unspecified
"Default color for background in `term'."
:group 'term
:type 'string)
--- 695,706 ----
;;; faces -mm
! (defcustom term-default-fg-color (face-foreground term-current-face)
"Default color for foreground in `term'."
:group 'term
:type 'string)
! (defcustom term-default-bg-color (face-background term-current-face)
"Default color for background in `term'."
:group 'term
:type 'string)
***************
*** 1098,1103 ****
--- 1098,1105 ----
(make-local-variable 'term-pending-delete-marker)
(setq term-pending-delete-marker (make-marker))
(make-local-variable 'term-current-face)
+ (setq term-current-face (list :background term-default-bg-color
+ :foreground term-default-fg-color))
(make-local-variable 'term-pending-frame)
(setq term-pending-frame nil)
;; Cua-mode's keybindings interfere with the term keybindings, disable it.
***************
*** 3055,3061 ****
(setq term-scroll-start 0)
(setq term-scroll-end term-height)
(setq term-insert-mode nil)
! (setq term-current-face nil)
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
--- 3057,3064 ----
(setq term-scroll-start 0)
(setq term-scroll-end term-height)
(setq term-insert-mode nil)
! (setq term-current-face (list :background term-default-bg-color
! :foreground term-default-fg-color))
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
***************
*** 3117,3123 ****
;;; 0 (Reset) or unknown (reset anyway)
(t
! (setq term-current-face nil)
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
--- 3120,3127 ----
;;; 0 (Reset) or unknown (reset anyway)
(t
! (setq term-current-face (list :background term-default-bg-color
! :foreground term-default-fg-color))
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
***************
*** 3154,3164 ****
(setq term-current-face
(list :background
(if (= term-ansi-current-color 0)
! (face-foreground 'default)
(elt ansi-term-color-vector term-ansi-current-color))
:foreground
(if (= term-ansi-current-bg-color 0)
! (face-background 'default)
(elt ansi-term-color-vector term-ansi-current-bg-color))))
(when term-ansi-current-bold
(setq term-current-face
--- 3158,3168 ----
(setq term-current-face
(list :background
(if (= term-ansi-current-color 0)
! term-default-fg-color
(elt ansi-term-color-vector term-ansi-current-color))
:foreground
(if (= term-ansi-current-bg-color 0)
! term-default-bg-color
(elt ansi-term-color-vector term-ansi-current-bg-color))))
(when term-ansi-current-bold
(setq term-current-face
***************
*** 3181,3189 ****
)
(setq term-current-face
(list :foreground
! (elt ansi-term-color-vector term-ansi-current-color)
:background
(elt ansi-term-color-vector term-ansi-current-bg-color)))
(when term-ansi-current-bold
(setq term-current-face
(append '(:weight bold) term-current-face)))
--- 3185,3198 ----
)
(setq term-current-face
(list :foreground
! (if (= term-ansi-current-color 0)
! term-default-fg-color
! (elt ansi-term-color-vector
term-ansi-current-color))
:background
+ (if (= term-ansi-current-bg-color 0)
+ term-default-bg-color
(elt ansi-term-color-vector term-ansi-current-bg-color)))
+ )
(when term-ansi-current-bold
(setq term-current-face
(append '(:weight bold) term-current-face)))
____________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch to term.el
2007-08-05 13:31 Patch to term.el Richard Stallman
@ 2007-08-05 14:14 ` Vinicius Jose Latorre
0 siblings, 0 replies; 2+ messages in thread
From: Vinicius Jose Latorre @ 2007-08-05 14:14 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
Richard Stallman wrote:
> Would someone please install this patch (a tiny change)
> in Emacs 22? It is a tiny change.
>
Done in trunk and Emacs 22 branch.
> Date: Mon, 23 Jul 2007 12:22:56 -0700 (PDT)
> From: Peter Povinec <pp_publiclists@yahoo.com>
> To: Dan Nicolaescu <dann@ics.uci.edu>
> In-Reply-To: <200707021728.l62HSpEj014971@oogie-boogie.ics.uci.edu>
> MIME-Version: 1.0
> Content-Type: text/plain; charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> Message-ID: <831335.3790.qm@web57313.mail.re1.yahoo.com>
> X-detected-kernel: FreeBSD 6.x (1)
> X-Mailman-Approved-At: Mon, 23 Jul 2007 16:43:41 -0400
> Cc: bug-gnu-emacs@gnu.org
> Subject: Re: Setting term-default-fg-color/term-default-bg-color has no
> effect
> X-BeenThere: bug-gnu-emacs@gnu.org
> X-Mailman-Version: 2.1.5
> Precedence: list
> List-Id: "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
> List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
> <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
> List-Archive: <http://lists.gnu.org/pipermail/bug-gnu-emacs>
> List-Post: <mailto:bug-gnu-emacs@gnu.org>
> List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
> List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
> <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
> Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
> Errors-To: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
> X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4)
>
>
>> Can you please describe exactly what are you doing and how? How did
>> you test your patch?
>>
>
> The basic idea is the same as it was in Emacs 21. Take the user preferences
> in terms of fg/bg colors as stored in term-default-fg-color and
> term-default-bg-color and apply them consistently every time term-current-face
> is set. This is done for the initial value of term-current-face, when the
> terminal is reset in term-reset-terminal, and when the escape sequences
> setting the default fg/bg colors are interpreted in term-handle-color-array.
> Note that this was partially done already in term-handle-color-array, e.g. in
> the case of setting reverse+invisible.
>
> For the testing, I've tested with my color customizations, including colored
> terminal prompt in csh. I verified the reverse video logic by running 'top'
> and 'emacs -nw' inside an ansi-term, both with my customizations, and plain
> emacs. Customizations to term-default-fg-color or term-default-bg-color while
> one or more term sessions are running take effect as expected, e.g. by running
> 'reset'.
>
>
>
>> >
>> > ! (defcustom term-default-fg-color (face-foreground term-current-face)
>> > "Default color for foreground in `term'."
>> > :group 'term
>> > :type 'string)
>> >
>> > ! (defcustom term-default-bg-color (face-background term-current-face)
>> > "Default color for background in `term'."
>> > :group 'term
>> > :type 'string)
>>
>> This can't be right, term-current-face is nil when term.el is
>> loaded...
>>
>
> See line 462 (in revision 1.89):
> (defvar term-current-face 'default)
>
> I'd agree the code would be easier to read if this line was moved, but as I
> mentioned I didn't want to do any unnecessary changes to keep this a tiny
> patch.
>
>
>
>> > + ;;; Start with requested fg/bg.
>> > + (setq term-current-face (list :background term-default-bg-color
>> > + :foreground term-default-fg-color))
>>
>> We don't want forms that have side effects at the top level...
>>
>
> Moved to (term-mode) now.
>
> The updated patch is below.
> HTH,
> --Peter
>
>
> 2007-07-23 Peter Povinec <ppovinec <at> yahoo.com>
>
> * term.el: Honor term-default-fg-color and term-default-bg-color
> settings when modifying term-current-face.
> (term-default-fg-color, term-default-bg-color): initialized from
> default term-current-face
> (term-mode, term-reset-terminal): set term-current-face with
> term-default-fg-color and term-default-bg-color
> (term-handle-colors-array): term-current-face has term-default-fg-color
> and term-default-bg-color after reset escape sequence
> (term-handle-colors-array): set term-current-color with
> term-default-fg/bg-color instead of ansi-term-color-vector when the
> index (term-ansi-current-color or term-ansi-current-bg-color) is zero
>
>
> *** /home/ppovinec/term.el.orig 2007-06-24 01:04:07.298996000 -0700
> --- /home/ppovinec/term.el 2007-07-23 12:18:01.418489000 -0700
> ***************
> *** 695,706 ****
>
> ;;; faces -mm
>
> ! (defcustom term-default-fg-color 'unspecified
> "Default color for foreground in `term'."
> :group 'term
> :type 'string)
>
> ! (defcustom term-default-bg-color 'unspecified
> "Default color for background in `term'."
> :group 'term
> :type 'string)
> --- 695,706 ----
>
> ;;; faces -mm
>
> ! (defcustom term-default-fg-color (face-foreground term-current-face)
> "Default color for foreground in `term'."
> :group 'term
> :type 'string)
>
> ! (defcustom term-default-bg-color (face-background term-current-face)
> "Default color for background in `term'."
> :group 'term
> :type 'string)
> ***************
> *** 1098,1103 ****
> --- 1098,1105 ----
> (make-local-variable 'term-pending-delete-marker)
> (setq term-pending-delete-marker (make-marker))
> (make-local-variable 'term-current-face)
> + (setq term-current-face (list :background term-default-bg-color
> + :foreground term-default-fg-color))
> (make-local-variable 'term-pending-frame)
> (setq term-pending-frame nil)
> ;; Cua-mode's keybindings interfere with the term keybindings, disable it.
> ***************
> *** 3055,3061 ****
> (setq term-scroll-start 0)
> (setq term-scroll-end term-height)
> (setq term-insert-mode nil)
> ! (setq term-current-face nil)
> (setq term-ansi-current-underline nil)
> (setq term-ansi-current-bold nil)
> (setq term-ansi-current-reverse nil)
> --- 3057,3064 ----
> (setq term-scroll-start 0)
> (setq term-scroll-end term-height)
> (setq term-insert-mode nil)
> ! (setq term-current-face (list :background term-default-bg-color
> ! :foreground term-default-fg-color))
> (setq term-ansi-current-underline nil)
> (setq term-ansi-current-bold nil)
> (setq term-ansi-current-reverse nil)
> ***************
> *** 3117,3123 ****
>
> ;;; 0 (Reset) or unknown (reset anyway)
> (t
> ! (setq term-current-face nil)
> (setq term-ansi-current-underline nil)
> (setq term-ansi-current-bold nil)
> (setq term-ansi-current-reverse nil)
> --- 3120,3127 ----
>
> ;;; 0 (Reset) or unknown (reset anyway)
> (t
> ! (setq term-current-face (list :background term-default-bg-color
> ! :foreground term-default-fg-color))
> (setq term-ansi-current-underline nil)
> (setq term-ansi-current-bold nil)
> (setq term-ansi-current-reverse nil)
> ***************
> *** 3154,3164 ****
> (setq term-current-face
> (list :background
> (if (= term-ansi-current-color 0)
> ! (face-foreground 'default)
> (elt ansi-term-color-vector term-ansi-current-color))
> :foreground
> (if (= term-ansi-current-bg-color 0)
> ! (face-background 'default)
> (elt ansi-term-color-vector term-ansi-current-bg-color))))
> (when term-ansi-current-bold
> (setq term-current-face
> --- 3158,3168 ----
> (setq term-current-face
> (list :background
> (if (= term-ansi-current-color 0)
> ! term-default-fg-color
> (elt ansi-term-color-vector term-ansi-current-color))
> :foreground
> (if (= term-ansi-current-bg-color 0)
> ! term-default-bg-color
> (elt ansi-term-color-vector term-ansi-current-bg-color))))
> (when term-ansi-current-bold
> (setq term-current-face
> ***************
> *** 3181,3189 ****
> )
> (setq term-current-face
> (list :foreground
> ! (elt ansi-term-color-vector term-ansi-current-color)
> :background
> (elt ansi-term-color-vector term-ansi-current-bg-color)))
> (when term-ansi-current-bold
> (setq term-current-face
> (append '(:weight bold) term-current-face)))
> --- 3185,3198 ----
> )
> (setq term-current-face
> (list :foreground
> ! (if (= term-ansi-current-color 0)
> ! term-default-fg-color
> ! (elt ansi-term-color-vector
> term-ansi-current-color))
> :background
> + (if (= term-ansi-current-bg-color 0)
> + term-default-bg-color
> (elt ansi-term-color-vector term-ansi-current-bg-color)))
> + )
> (when term-ansi-current-bold
> (setq term-current-face
> (append '(:weight bold) term-current-face)))
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-05 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-05 13:31 Patch to term.el Richard Stallman
2007-08-05 14:14 ` Vinicius Jose Latorre
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).