earth tech

[software and hardware technology originating from or otherwise pertinent to planet earth]

use these buttons to share this blog on portal sites:

Add to Google

Monday, October 26, 2009

 

Fix Emacs Backspace Ctl-H

Put this in your .emacs file...

(global-set-key "\C-h" 'backward-delete-char)

Labels: ,

Wednesday, September 2, 2009

 

ASCII 0x07 - The BEL Character

http://linux.com/learn/docs/ldp/811-Visual-Bell

The Visible bell mini-Howto describes the measures necessary to disable audio processing of the ASCII system bell (0x07 – BEL) character as a console "beep" in various shells and applications, including Bash and Emacs. under Linux.

Labels: , , , , , , , ,

Wednesday, July 29, 2009

 

Emacs mixed-mode PHP sources

Caveat: For these ideas to work, you might [depending on your system] need to download and install either or both of these Elisp modules:

   php-mode
   css-mode

Presumption [for the purposes of this tip]:  IF you are using Emacs to edit PHP and/or CSS, THEN you know about and are using one or the other or both of these modules. If not, then you should probably give up now or seek professional help immediately.

Task:  Editing a PHP source file using Emacs can involve working in several source code language formatting modes, since it is common to mix PHP, CSS, (X)HTML, Javascript, and even MySQL query syntax in one PHP source file.

Rationale:  Although mixing languages in a single source file may on the face of it seem to violate the kind of *nixish organizational precepts that give us e.g. header (.h) and source (.c) files in C, sometimes painful experience has shown that the object oriented (OOD) precepts of "Encapsulation", "Isolation of Commonality", "Maintainability", and even (in some cases) "Human Readability" are all served by facilitating the mixing of languages within a single source file.

All that to say this: When editing a block of CSS code within a PHP file (using Emacs, of course), I have found it helpful to use the Emacs 'css-mode' Meta-Q key binding to format CSS rule blocks. However, when entering a multi-line CSS comment in the traditional 'C' style, it is useful to ask Emacs to use 'php-mode' Meta-Q to format the comments.

<?php 
$str = "example";
>
<style<
body {
  /* 
   * To format this comment block:
   * 1. Move the cursor to this line 
   * 2. Meta-X php-mode
   * 3. Meta-Q 
   *
   */
  margin:0;
  padding:0;
}

Summary:

Labels: , , , , ,

Sunday, March 15, 2009

 

HowTo: Hide listings of hidden directories in Emacs 'dired' mode.

In order to not show hidden file names in the Emacs dired directory listings, take the following steps:

  1. Use the Meta–x to enter a command.
  2. At the M–x prompt, type customize–groupand hit <Enter>
  3. At the ’Customize group (default emacs):’ prompt type ’dired
  4. In the Emacs customization buffer for group Dired, find the option setting titled List Directory Verbose Switches [option variable name is list-directory-verbose-switches]
  5. Remove the a from the string value provided to list-directory-verbose-switches
  6. Save the changes.

Here is the Lisp code to set this option:

(if
    (eq system-type 'vax-vms)
    "/PROTECTION/SIZE/DATE/OWNER/WIDTH=(OWNER:10)" "-l")

The Lisp code can be placed in the .emacs file manually, if that method of editing and setting the Emacs environment options is preferred.

Labels: , , , , ,

Saturday, February 7, 2009

 

Emacs TRAMP

http://www.gnu.org/software/tramp/

Neat. Remember all those years ago when you were opening and editing files on remote servers using Emacs and its Ange-FTP module? Remember how it all went bad back during the war when packet sniffers became common, and you couldn't trust your password to the wires, anymore? Remember the joy you felt when you realized that ssh, scp, and sftp had it within their power to fix all that for good and all as soon as all those benighted ISPs opened port 22 to their secure shell servers instead of those stupid other ports and their clear-text protocols? Remember the angst you felt waiting for some Lisp guru to take pity on your pathetic ineptitude with with her parenthetical language and code you up an SSH-based file I/O substrate for your favorite horned text processing system? Remember the bleak years of despair and hopelessness you spent trashing random windows boxes, wracked with frustration as your Emacs-nox was denied you by petty bureaucrats and ill-conceived Win32 solutions?

Rejoice now, all ye stricken!

http://www.gnu.org/software/tramp/

ftp://ftp.gnu.org/gnu/tramp/

One (1) prop to the KDE Help System and its authors, that's where we discovered all this... would add another if there was a way to provide a bookmark into the desktop help system, here - as is, I don't even have the hierarchical path info - just the document title [TRAMP version 2.0.57 User Manual], which doesn't seem to be useful in finding the file within the help system, as the "search" function has some grievance that remains un-addressed....

Labels: , , ,

Friday, January 12, 2007

 

GNU Emacs Mouse Wheel

Scott Hurring's .emacs has some lines of interest:

;; Turn ON mouse wheel support
(mouse-wheel-mode)

This mouse-wheel-mode doesn't seem to be available in GNU Emacs 20.4.1 (sparc-sun-solaris2.5.1) - instead a couple functions are defined in the .emacs:

;; Mousewheel
(defun sd-mousewheel-scroll-up (event)
  "Scroll window under mouse up by five lines."
  (interactive "e")
  (let ((current-window (selected-window)))
    (unwind-protect
        (progn 
          (select-window (posn-window (event-start event)))
          (scroll-up 5))
      (select-window current-window))))

(defun sd-mousewheel-scroll-down (event)
  "Scroll window under mouse down by five lines."
  (interactive "e")
  (let ((current-window (selected-window)))
    (unwind-protect
        (progn 
          (select-window (posn-window (event-start event)))
          (scroll-down 5))
      (select-window current-window))))

(global-set-key (kbd "") 'sd-mousewheel-scroll-up)
(global-set-key (kbd "") 'sd-mousewheel-scroll-down)

Seems like quite a lot of code, but this probably is what's obscured by the mwheel and mouse-wheel-mode modules.

According to the Fedora Emacs docs, the following should work with "the older version 20 of Emacs":

;; Enable wheelmouse support by default
(require 'mwheel)

However, this doesn't seem to work with the Solaris version - probably because mwheel appears is not installed.

Other items of interest here include:

;; show line numbers at bottom
(setq line-number-mode t)
(setq column-number-mode t)
(line-number-mode t)
(column-number-mode t)

;; no crap in *scratch* on startup
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)

Labels: , , ,

Archives

2006/12   2007/01   2007/05   2007/06   2007/07   2007/08   2007/10   2008/01   2008/02   2008/03   2008/05   2008/11   2008/12   2009/01   2009/02   2009/03   2009/04   2009/05   2009/07   2009/09   2009/10   2009/11   2009/12   2010/01  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]