unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Setting term-default-fg-color/term-default-bg-color has no effect
@ 2007-06-30  0:17 Peter Povinec
  2007-07-02 17:28 ` Dan Nicolaescu
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Povinec @ 2007-06-30  0:17 UTC (permalink / raw)
  To: bug-gnu-emacs

Hi!

I use ansi-term a lot and like to have different color scheme for my term
buffers.  After upgrading to Emacs22 from 21.4 I notice that my setting of
term-default-fg-color/term-default-bg-color no longer has any effect.  I found
no documentation stating that it was not supported in Emacs22, so I suppose it
is a bug. 

I looked at the old 21.4 code and based on that created the following minimalist
patch, which is satisfactory in addressing the issue.  

HTH,
--Peter



2007-06-25  Peter Povinec  <ppovinec <at> yahoo.com>

	* term.el: Honor term-default-fg-color and term-default-bg-color
	settings when modifying term-current-face.


*** /home/ppovinec/term.el.orig	2007-06-24 01:04:07.298996000 -0700
--- /home/ppovinec/term.el	2007-06-25 16:40:33.434255000 -0700
***************
*** 695,710 ****
  
  ;;; 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)
  
  ;;; Use the same colors that xterm uses, see `xterm-standard-colors'.
  (defvar ansi-term-color-vector
    [unspecified "black" "red3" "green3" "yellow3" "blue2"
--- 695,714 ----
  
  ;;; 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)
  
+ ;;; Start with requested fg/bg.
+ (setq term-current-face (list :background term-default-bg-color 
+                               :foreground term-default-fg-color))
+ 
  ;;; Use the same colors that xterm uses, see `xterm-standard-colors'.
  (defvar ansi-term-color-vector
    [unspecified "black" "red3" "green3" "yellow3" "blue2"
***************
*** 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)
--- 3059,3066 ----
    (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)
--- 3122,3129 ----
  
  ;;; 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
--- 3160,3170 ----
  	    (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)))
--- 3187,3200 ----
  		  )
  	  (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] 7+ messages in thread

end of thread, other threads:[~2007-08-03  6:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-30  0:17 Setting term-default-fg-color/term-default-bg-color has no effect Peter Povinec
2007-07-02 17:28 ` Dan Nicolaescu
2007-07-23 19:22   ` Peter Povinec
2007-08-01  4:10     ` Dan Nicolaescu
2007-08-02  0:50       ` Peter Povinec
2007-08-02  2:28         ` Dan Nicolaescu
2007-08-03  6:35           ` Peter Povinec

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