all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* term.el fixes
@ 2004-09-15 17:13 Dan Nicolaescu
  2004-09-16 18:45 ` more " Dan Nicolaescu
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nicolaescu @ 2004-09-15 17:13 UTC (permalink / raw)


This patch contains a few fixes for term.el

- A few dead variables and a dead function have been deleted.

- The TERMCAP entry was out of sync with the terminfo entry in
etc/e/eterm.ti, quite a few capabilities were missing.
This was tested by running a version of Midnight Commander that uses
TERMCAP in a M-x term terminal. It was able to use colors and display
correctly. 

- The reverse video mode did not work. This can be seen by the fact
that running "tput rev" before the patch did not have any
effect. After the patch it turns on reverse video. Also before the
patch the modeline for an "emacs -nw" running in a M-x term terminal
was shown with the default face, after the patch the modeline is shown
in reverse video as expected.

- term-exec-1 was deciding to bound either the TERMCAP or TERMINFO
environment variable based on the value of `system-uses-terminfo',
which is a emacs compile time constant. This is not correct as on the
same system some applications can still use TERMCAP, not terminfo. So
it is probably better to set both variables all the time. 

Please apply this patch if it's OK. 

2004-09-15  Dan Nicolaescu  <dann@ics.uci.edu>

	* term.el (term-exec-1): Set both TERMCAP and TERMINFO
	unconditionally. 
	(term-termcap-format): Synchronyze with the eterm terminfo entry
	in etc/e/eterm.ti.
	(term-handle-colors-array): If the current foreground or
	background are zero (i.e. unspecified), use the foreground and
	background of the default face for reverse video.
	(term-ansi-at-eval-string, term-ansi-default-fg)
	(term-ansi-default-bg, term-ansi-current-temp): Delete unused
	variable. 
	(term-mem): Delete ununsed function.


*** term.el	07 Sep 2004 15:26:52 -0700	1.56
--- term.el	15 Sep 2004 10:08:19 -0700	
***************
*** 676,682 ****
  (defvar term-terminal-menu)
  
  ;;; Let's silence the byte-compiler -mm
- (defvar term-ansi-at-eval-string nil)
  (defvar term-ansi-at-host nil)
  (defvar term-ansi-at-dir nil)
  (defvar term-ansi-at-user nil)
--- 676,681 ----
***************
*** 692,700 ****
  (defvar term-ansi-current-highlight 0)
  (defvar term-ansi-current-reverse 0)
  (defvar term-ansi-current-invisible 0)
- (defvar term-ansi-default-fg 0)
- (defvar term-ansi-default-bg 0)
- (defvar term-ansi-current-temp 0)
  
  ;;; Four should be enough, if you want more, just add. -mm
  (defvar term-terminal-more-parameters 0)
--- 691,696 ----
***************
*** 1365,1375 ****
  (defvar term-termcap-format
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
! :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=\\n\
  :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
! :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC"
  ;;; : -undefine ic
    "termcap capabilities supported")
  
--- 1361,1374 ----
  (defvar term-termcap-format
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
! :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
  :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
! :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
! :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
! :mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
! :bl=^G:do=^J:le=^H:ta=^I:"
  ;;; : -undefine ic
    "termcap capabilities supported")
  
***************
*** 1386,1395 ****
  	 (nconc
  	  (list
  	   (format "TERM=%s" term-term-name)
! 	   (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
! 	       (format "TERMINFO=%s" data-directory)
! 	    (format term-termcap-format "TERMCAP="
! 		    term-term-name term-height term-width))
  	   ;; Breaks `./configure' of w3 and url which try to run $EMACS.
  	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
  	   (format "LINES=%d" term-height)
--- 1385,1393 ----
  	 (nconc
  	  (list
  	   (format "TERM=%s" term-term-name)
! 	   (format "TERMINFO=%s" data-directory)
! 	   (format term-termcap-format "TERMCAP="
! 		   term-term-name term-height term-width)
  	   ;; Breaks `./configure' of w3 and url which try to run $EMACS.
  	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
  	   (format "LINES=%d" term-height)
***************
*** 1409,1426 ****
  	   ".."
  	   command switches)))
  
- ;;; This should be in Emacs, but it isn't.
- (defun term-mem (item list &optional elt=)
-   "Test to see if ITEM is equal to an item in LIST.
- Option comparison function ELT= defaults to equal."
-   (let ((elt= (or elt= (function equal)))
- 	(done nil))
-     (while (and list (not done))
-       (if (funcall elt= item (car list))
- 	  (setq done list)
- 	  (setq list (cdr list))))
-     done))
- 
  \f
  ;;; Input history processing in a buffer
  ;;; ===========================================================================
--- 1407,1412 ----
***************
*** 3044,3052 ****
  		    )
  	    (setq term-current-face
  		  (list :background
! 			(elt ansi-term-color-vector term-ansi-current-color)
  			:foreground
! 			(elt ansi-term-color-vector term-ansi-current-bg-color)))
  	    (if (= term-ansi-current-bold 1)
  		(setq term-current-face
  		      (append '(:weight bold) term-current-face)))
--- 3030,3042 ----
  		    )
  	    (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))))
  	    (if (= term-ansi-current-bold 1)
  		(setq term-current-face
  		      (append '(:weight bold) term-current-face)))

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

* more term.el fixes
  2004-09-15 17:13 term.el fixes Dan Nicolaescu
@ 2004-09-16 18:45 ` Dan Nicolaescu
  2004-09-17 21:11   ` Kim F. Storm
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nicolaescu @ 2004-09-16 18:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 8785 bytes --]


This patch includes my patch from yesterday, plus a few more fixes. 

- A few dead variables and a dead function have been deleted.

- The TERMCAP entry was out of sync with the terminfo entry in
etc/e/eterm.ti, quite a few capabilities were missing.
This was tested by running a version of Midnight Commander that uses
TERMCAP in a M-x term terminal. It was able to use colors and display
correctly. 

- The reverse video mode did not work. This can be seen by the fact
that running "tput rev" before the patch did not have any
effect. After the patch it turns on reverse video. Also before the
patch the modeline for an "emacs -nw" running in a M-x term terminal
was shown with the default face, after the patch the modeline is shown
in reverse video as expected.

- term-exec-1 was deciding to bound either the TERMCAP or TERMINFO
environment variable based on the value of `system-uses-terminfo',
which is a emacs compile time constant. This is not correct as on the
same system some applications can still use TERMCAP, not terminfo. So
it is probably better to set both variables all the time. 

- the eterm terminfo strings for rmso rmul and sgr0 were identical, so
it wasn't possible to remove just one attribute at a time, for example
doing: 
tput smso 
tput smul 
and then 
tput rmso 
would remove the underline attribute too. So rmso and rmul got
different terminfo strings (taken from what xterm uses) and a few
lines of code were added to handle them. Now the above sequence of
tput commands works correctly.

- term-current-face was set to the inexistent term-default face. This
was causing errors to appear in the *Messages* buffer. It was changed
to 'default. 


Please apply this patch if it's OK. 

2004-09-15  Dan Nicolaescu  <dann@ics.uci.edu>

	* term.el (term-exec-1): Set both TERMCAP and TERMINFO
	unconditionally. 
	(term-termcap-format): Synchronyze with the eterm terminfo entry
	in etc/e/eterm.ti.
	(term-handle-colors-array): If the current foreground or
	background are zero (i.e. unspecified), use the foreground and
	background of the default face for reverse video.
	(term-ansi-at-eval-string, term-ansi-default-fg)
	(term-ansi-default-bg, term-ansi-current-temp): Delete unused
	variable. 
	(term-mem): Delete ununsed function.
	(term-protocol-version): Increment.
	(term-current-face): Set to default.


For etc/ChangeLog
2004-09-16  Dan Nicolaescu  <dann@ics.uci.edu>

	* e/eterm.ti: Change the strings for smso and rmso.
          e/eterm: Regenerate.


*** term.el	07 Sep 2004 15:26:52 -0700	1.56
--- term.el	16 Sep 2004 11:12:36 -0700	
***************
*** 396,402 ****
  
  ;; This is passed to the inferior in the EMACS environment variable,
  ;; so it is important to increase it if there are protocol-relevant changes.
! (defconst term-protocol-version "0.95")
  
  (eval-when-compile
    (require 'ange-ftp))
--- 396,402 ----
  
  ;; This is passed to the inferior in the EMACS environment variable,
  ;; so it is important to increase it if there are protocol-relevant changes.
! (defconst term-protocol-version "0.96")
  
  (eval-when-compile
    (require 'ange-ftp))
***************
*** 457,463 ****
  ;;		we want suppressed.
  (defvar term-terminal-parameter)
  (defvar term-terminal-previous-parameter)
! (defvar term-current-face 'term-default)
  (defvar term-scroll-start 0) ;; Top-most line (inclusive) of scrolling region.
  (defvar term-scroll-end) ;; Number of line (zero-based) after scrolling region.
  (defvar term-pager-count nil) ;; If nil, paging is disabled.
--- 457,463 ----
  ;;		we want suppressed.
  (defvar term-terminal-parameter)
  (defvar term-terminal-previous-parameter)
! (defvar term-current-face 'default)
  (defvar term-scroll-start 0) ;; Top-most line (inclusive) of scrolling region.
  (defvar term-scroll-end) ;; Number of line (zero-based) after scrolling region.
  (defvar term-pager-count nil) ;; If nil, paging is disabled.
***************
*** 1365,1375 ****
  (defvar term-termcap-format
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
! :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=\\n\
  :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
! :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC"
  ;;; : -undefine ic
    "termcap capabilities supported")
  
--- 1365,1378 ----
  (defvar term-termcap-format
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
! :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
  :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
! :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
! :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
! :mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
! :bl=^G:do=^J:le=^H:ta=^I:se=\E[27m:ue=\E24m:"
  ;;; : -undefine ic
    "termcap capabilities supported")
  
***************
*** 1386,1395 ****
  	 (nconc
  	  (list
  	   (format "TERM=%s" term-term-name)
! 	   (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
! 	       (format "TERMINFO=%s" data-directory)
! 	    (format term-termcap-format "TERMCAP="
! 		    term-term-name term-height term-width))
  	   ;; Breaks `./configure' of w3 and url which try to run $EMACS.
  	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
  	   (format "LINES=%d" term-height)
--- 1389,1397 ----
  	 (nconc
  	  (list
  	   (format "TERM=%s" term-term-name)
! 	   (format "TERMINFO=%s" data-directory)
! 	   (format term-termcap-format "TERMCAP="
! 		   term-term-name term-height term-width)
  	   ;; Breaks `./configure' of w3 and url which try to run $EMACS.
  	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
  	   (format "LINES=%d" term-height)
***************
*** 1409,1426 ****
  	   ".."
  	   command switches)))
  
- ;;; This should be in Emacs, but it isn't.
- (defun term-mem (item list &optional elt=)
-   "Test to see if ITEM is equal to an item in LIST.
- Option comparison function ELT= defaults to equal."
-   (let ((elt= (or elt= (function equal)))
- 	(done nil))
-     (while (and list (not done))
-       (if (funcall elt= item (car list))
- 	  (setq done list)
- 	  (setq list (cdr list))))
-     done))
- 
  \f
  ;;; Input history processing in a buffer
  ;;; ===========================================================================
--- 1411,1416 ----
***************
*** 2990,2995 ****
--- 2980,2993 ----
     ((eq parameter 8)
      (setq term-ansi-current-invisible 1))
  
+ ;;; Reset reverse (i.e. terminfo rmso)
+    ((eq parameter 24)
+     (setq term-ansi-current-reverse 0))
+ 
+ ;;; Reset underline (i.e. terminfo rmul)
+    ((eq parameter 27)
+     (setq term-ansi-current-underline 0))
+ 
  ;;; Foreground
     ((and (>= parameter 30) (<= parameter 37))
      (setq term-ansi-current-color (- parameter 29)))
***************
*** 3044,3052 ****
  		    )
  	    (setq term-current-face
  		  (list :background
! 			(elt ansi-term-color-vector term-ansi-current-color)
  			:foreground
! 			(elt ansi-term-color-vector term-ansi-current-bg-color)))
  	    (if (= term-ansi-current-bold 1)
  		(setq term-current-face
  		      (append '(:weight bold) term-current-face)))
--- 3042,3054 ----
  		    )
  	    (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))))
  	    (if (= term-ansi-current-bold 1)
  		(setq term-current-face
  		      (append '(:weight bold) term-current-face)))


*** eterm.ti	07 Sep 2004 15:26:51 -0700	1.2
--- eterm.ti	15 Sep 2004 14:39:37 -0700	
***************
*** 12,19 ****
  	smcup=\E7\E[?47h,rmcup=\E[2J\E[?47l\E8,
  	ht=\t,khome=\E[1~,kend=\E[4~,knp=\E[6~,kpp=\E[5~,
  	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
! 	smso=\E[7m,rmso=\E[m,
! 	smul=\E[4m,rmul=\E[m,
  	rev=\E[7m,bold=\E[1m,sgr0=\E[m,
  	invis=\E[8m,op=\E[39;49m,
  	setab=\E[%p1%{40}%+%dm, setaf=\E[%p1%{30}%+%dm,
--- 12,19 ----
  	smcup=\E7\E[?47h,rmcup=\E[2J\E[?47l\E8,
  	ht=\t,khome=\E[1~,kend=\E[4~,knp=\E[6~,kpp=\E[5~,
  	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
! 	smso=\E[7m,rmso=\E[27m,
! 	smul=\E[4m,rmul=\E[24m,
  	rev=\E[7m,bold=\E[1m,sgr0=\E[m,
  	invis=\E[8m,op=\E[39;49m,
  	setab=\E[%p1%{40}%+%dm, setaf=\E[%p1%{30}%+%dm,



[-- Attachment #2: eterm --]
[-- Type: application/octet-stream, Size: 1095 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: more term.el fixes
  2004-09-16 18:45 ` more " Dan Nicolaescu
@ 2004-09-17 21:11   ` Kim F. Storm
  0 siblings, 0 replies; 3+ messages in thread
From: Kim F. Storm @ 2004-09-17 21:11 UTC (permalink / raw)
  Cc: emacs-devel

Dan Nicolaescu <dann@godzilla.ics.uci.edu> writes:

> This patch includes my patch from yesterday, plus a few more fixes. 
>
> Please apply this patch if it's OK. 

Installed.

>
> 2004-09-15  Dan Nicolaescu  <dann@ics.uci.edu>
>
> 	* term.el (term-exec-1): Set both TERMCAP and TERMINFO
> 	unconditionally. 
> 	(term-termcap-format): Synchronyze with the eterm terminfo entry
> 	in etc/e/eterm.ti.
> 	(term-handle-colors-array): If the current foreground or
> 	background are zero (i.e. unspecified), use the foreground and
> 	background of the default face for reverse video.
> 	(term-ansi-at-eval-string, term-ansi-default-fg)
> 	(term-ansi-default-bg, term-ansi-current-temp): Delete unused
> 	variable. 
> 	(term-mem): Delete ununsed function.
> 	(term-protocol-version): Increment.
> 	(term-current-face): Set to default.
>
>
> For etc/ChangeLog
> 2004-09-16  Dan Nicolaescu  <dann@ics.uci.edu>
>
> 	* e/eterm.ti: Change the strings for smso and rmso.
>           e/eterm: Regenerate.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2004-09-17 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-15 17:13 term.el fixes Dan Nicolaescu
2004-09-16 18:45 ` more " Dan Nicolaescu
2004-09-17 21:11   ` Kim F. Storm

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.