2010-04-06

screen, tset, & emacs

Have had an issue w/ using emacs and screen together under Bash on a CentOS Linux host.

Problem

The problem manifests in two ways:

  1. font-lock-mode does not show in color, or in a limited subset of colors
  2. the Backspace key sends ^H but Emacs recognizes it as the "Help" invocation, and starts up the Help system

These problems have been showing up under screen but not when Emacs is started outside screen in the normal Bash shell.

Changing the TERM value and/or the Backspace in either or both of the terminal emulator software (PuTTY) did not fix the problem.

Setting the value of the TERM environment value in Bash had no apparent effect.

The Fix

Use tset to set the backspace character in the Bash shell before screen is started.

tset -e ^H

This works when TERM=vt102 in the Bash environment, and 'VT100+' is checked for the terminal type in PuTTY. Other term types may vary.

Note that for some reason the font-lock-mode problem went away, too.

2010-03-08

Favorite Emacs Customizations

Somebody asked me the other day what Emacs customizations use. My response was that I don't use many customizations in Emacs because it would require me to carry those customizations around with me. However, I thought I would make a list, since this will be useful in the future when I am - again - using a vanilla Emacs install and want to make all the customizations at once, at startup.

Option Configuration

column-number-mode: HIDE
scroll-bar-mode:OFF
tool-bar-mode:OFF
auto-fill-mode:ON
transient-mark-mode:ON
global-font-lock-mode:ON

Major Modes

sgml-mode
html-mode
php-mode
js-mode
css-mode

sgml / html modes are commonly installed by default, now, and I've seen a couple installs where php-mode and one or more of javascript-mode (or js-mode) and css-mode were also installed "out-of-the-box"

These modes are all defined by Elisp (.el) library files (usually compiled to .elc files). Once the library files are installed (e.g. in /usr/lib/perl/<ver>/site/ or /usr/share/emacs/site or whereever), they can be loaded using M-x 'load-library' command.

These libraries can also be loaded from your .emacs file and made to use a 'hook' function that auto-loads the appropriate mode based on the file extension cue for the source language of the file.

Links

2010-01-08

Bash code: CVS status logging

This command has the effect of checking each of the indicated files in the source tree against the CVS repository - errors should be propagated to stderr if a file in the source tree does not exist in the CVS repository - this cmd should be refined into a script which tests for error on status and tries to add source files which do not appear to be in the repository....

for fn in *.{css,js,html,php} ./xml/*.xml ./xml/services/*.xml ./js/*.js ; 
    do echo $fn ; 
    cvs status $fn; 
    echo ""; done > cvs-status.txt

Note that the command cvs status [in src dir, w/ no args] does something similar to the above command, differing in that using cvs status may not handle the cases a source file exists which has not been added to the repository.

The CVS manpage does not address this:

       status [-lRqQ] [-v] [files...]
              Requires: working directory, repository.
              Changes: nothing.
              Display a brief report on  the  current  status  of  files  with
              respect to the source repository, including any ``sticky'' tags,
              dates, or -k options.  (``Sticky''  options  will  restrict  how
              `cvs  update' operates until you reset them; see the description
              of `cvs update -A...'.)

              You can also use this command to anticipate the potential impact
              of  a  `cvs update' on your working source directory.  If you do
              not specify any files explicitly,  reports  are  shown  for  all
              files  that  cvs  has placed in your working directory.  You can
              limit the scope of this search to the current  directory  itself
              (not  its  subdirectories)  with the standard -l option flag; or
              you can explicitly request recursive status reports with the  -R
              option.

              The  -v  option  causes the symbolic tags for the RCS file to be
              displayed as well.