- http://search.cpan.org/~yewenbin/Emacs-PDE-0.2.16/lib/Emacs/PDE.pm
- http://www.emacswiki.org/emacs/PerlLanguage
- http://www.emacswiki.org/emacs/CPerlMode
- http://cpansearch.perl.org/src/YEWENBIN/Emacs-PDE-0.2.16/lisp/doc/QuickStartEn.html
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts
Debugging Perl in Emacs
Notes only:
Emacs for a vi user
In the past I've exclusively used vi, but now I want to use Emacs as I've heard it has some useful modes, for example 'font-lock-keywords' mode which is one way to easily highlight certain keywords in a program's console output. I don't want to mess around compiling specialised text highlighting programs, and they're not in my standard repos. Emacs is much more likely to already be available wherever I need it.
Emacs commands:
Emacs commands:
- To exit: C-x C-c
- Turn on syntax highlighting: M-x font-lock-mode
Key:
C = Ctrl
M = Meta (Alt)
Thanks to the rest of the web
UPDATE: It turns out font-lock-keywords can easily be implemented in a 3 line bash script. Call it "highlight":
# Usage: tail -f error.log | highlight "error"
RED="$(tput setaf 1)"
RESET="$(tput setaf 7)"
sed "s/$1/$RED$1$RESET/"
But I would still like to see the Perl debugger integrated into Emacs
UPDATE: It turns out font-lock-keywords can easily be implemented in a 3 line bash script. Call it "highlight":
# Usage: tail -f error.log | highlight "error"
RED="$(tput setaf 1)"
RESET="$(tput setaf 7)"
sed "s/$1/$RED$1$RESET/"
Labels:
article,
emacs,
productivity,
text editor,
vi
Setting up xemacs xslt-process mode
I set all these options in the environment:
#########################
# copied from /etc/java/java.conf
# JPackage Project
#########################
# Location of jar files on the system
export JAVA_LIBDIR=/usr/share/java
# Location of arch-specific jar files on the system
export JNI_LIBDIR=/usr/lib/java
# List of known java homes (used for autodetection if none is provided)
export JAVA_HOME_LIST=$JAVA_LIBDIR-utils/java_home.list
# Root of all JVM installations
export JVM_ROOT=/usr/lib/jvm
# Default jvm
export JAVA_HOME=$JVM_ROOT/java
# Options to pass to the java interpreter
export JAVACMD_OPTS=
#########################
export CLASSPATH=/usr/share/java
Now when I try to run xslt-process, it says:
Starting the BeanShell. Please wait...
...but then straight away it still always says:
Could not process file, most probably (Xalan1|Saxon) could not be found!
What I think is happening:
#########################
# copied from /etc/java/java.conf
# JPackage Project
#########################
# Location of jar files on the system
export JAVA_LIBDIR=/usr/share/java
# Location of arch-specific jar files on the system
export JNI_LIBDIR=/usr/lib/java
# List of known java homes (used for autodetection if none is provided)
export JAVA_HOME_LIST=$JAVA_LIBDIR-utils/java_home.list
# Root of all JVM installations
export JVM_ROOT=/usr/lib/jvm
# Default jvm
export JAVA_HOME=$JVM_ROOT/java
# Options to pass to the java interpreter
export JAVACMD_OPTS=
#########################
export CLASSPATH=/usr/share/java
Now when I try to run xslt-process, it says:
Starting the BeanShell. Please wait...
...but then straight away it still always says:
Could not process file, most probably (Xalan1|Saxon) could not be found!
What I think is happening:
- xalan-2.4.1.jar is installed, not xalan1 as is required.
- Not all of saxon's dependencies are installed.
Working with xemacs XSLT-process mode
M-x xslt-process-mode - enable xslt-process mode
C-c C-x v - run the xslt processor and view results (be sure to type slowly enough!)
M-x customize-group RET xslt-process - options menu: change engine, customise key bindings, etc.
NOTE: the default run command above may have problems under cygwin. Redefine it to C-x C-c C-v and it should work.
C-c C-x v - run the xslt processor and view results (be sure to type slowly enough!)
M-x customize-group RET xslt-process - options menu: change engine, customise key bindings, etc.
NOTE: the default run command above may have problems under cygwin. Redefine it to C-x C-c C-v and it should work.
Labels:
debugging,
emacs,
text editor,
xml,
xsl
xemacs buffer control
C-x b [buffer] [enter] - select or create a named buffer
C-x C-b - list existing buffers
C-x 1 - close the buffer list
C-x C-b - list existing buffers
C-x 1 - close the buffer list
Labels:
buffer,
emacs,
files,
text editor
Emacs and Cygwin
Can't quit emacs from cygwin?
From within Cygwin, if you start xemacs with: xemacs -nw (for No Window), then C-x C-c to quit emacs does not work. Instead you must type C-g to exit.
From within Cygwin, if you start xemacs with: xemacs -nw (for No Window), then C-x C-c to quit emacs does not work. Instead you must type C-g to exit.
xemacs mode line
How to interpret the status line in xemacs:
http://www.xemacs.org/Documentation/21.5/html/xemacs_4.html#SEC10
http://www.xemacs.org/Documentation/21.5/html/xemacs_4.html#SEC10
Labels:
emacs,
manual,
text editor
GNU info
navigate within info screens:
| b | go to beginning of the page |
| ? | help |
| m | choose a menu item from the current page (has tab completion) |
| f | choose a cross-reference to follow (tab completion) |
| f? | list all cross-references on the current page |
| l | go back to last page |
| Ctrl-g | cancel menu command |
| i | search index for topic |
| d | directory of all info pages |
| t | go to 'top' of current manual |
| s | search forward |
| q | quit info screen |
Emacs
Emacs is desirable for its XSLT debug mode, Emacs::PDE, and font-lock-keywords mode
Viper is a full-featured Vi emulator for GNU Emacs and XEmacs. But if you don't use that, keep reading.
Emacs notes, from the perspective of a vi user
Problems:
* The manual calls for C-h (Ctrl-h) to be used as a special command
** but when using Putty from Windows, by default Ctrl-h just does a backspace.
** from Windows, it can't tell the difference between Ctrl-H and the backspace key
** This means if you re-map Ctrl-H, it also re-maps the Backspace key. I haven't solved this yet.
--------------------------------------------------------
To read the manual on key commands:
1) type F1, i - gets you to the info menu
2) type m, emacs, [enter] - takes you to the Emacs info file
3) Page down to "Fundamental Editing Commands", "Important Text-Changing Commands", etc. and press [enter] on the menu items you want (typing lowercase L takes you
'back' one page)
--------------------------------------------------------
Notes:
* Terminology: C-x means Ctrl-x, C-M-x means Ctrl-Meta-x - the Meta key is Alt under MS Windows)
* For some commands, holding Ctrl is required for the second character (e.g. quit: C-x, C-c), and for others commands it's not (e.g. undo: C-x u)
* Commands like this "M-x set-visited-file-name" mean: type Meta-x, then type the string 'set-visited-file-name'.
* After typing M-x you can also use tab-completion to find commands.
Translation of common Emacs commands for vi users:
Notes on differences to vi:
* undo commands wrap around. Once you undo all your edits, the undo command reverses direction and starts re-doing the edits! break out of the undo mode and press C-_ (undo) again to change the direction of undo/redo command.
* files are autosaved to a seperate buffer. to recover after a crash, type: M-x recover-file foo.c
Emacs-only commands:
Viper is a full-featured Vi emulator for GNU Emacs and XEmacs. But if you don't use that, keep reading.
Emacs notes, from the perspective of a vi user
Problems:
* The manual calls for C-h (Ctrl-h) to be used as a special command
** but when using Putty from Windows, by default Ctrl-h just does a backspace.
** from Windows, it can't tell the difference between Ctrl-H and the backspace key
** This means if you re-map Ctrl-H, it also re-maps the Backspace key. I haven't solved this yet.
--------------------------------------------------------
To read the manual on key commands:
1) type F1, i - gets you to the info menu
2) type m, emacs, [enter] - takes you to the Emacs info file
3) Page down to "Fundamental Editing Commands", "Important Text-Changing Commands", etc. and press [enter] on the menu items you want (typing lowercase L takes you
'back' one page)
--------------------------------------------------------
Notes:
* Terminology: C-x means Ctrl-x, C-M-x means Ctrl-Meta-x - the Meta key is Alt under MS Windows)
* For some commands, holding Ctrl is required for the second character (e.g. quit: C-x, C-c), and for others commands it's not (e.g. undo: C-x u)
* Commands like this "M-x set-visited-file-name" mean: type Meta-x, then type the string 'set-visited-file-name'.
* After typing M-x you can also use tab-completion to find commands.
Translation of common Emacs commands for vi users:
| command | vi | emacs |
| save file | :w | C-x C-s |
| save & exit read-only file | :wq! | C-x, C-c, follow prompts |
| save to a different file | :w foo | M-x set-visited-file-name |
| find a file to open | C-x C-f | |
| delete to end of line | Shift-d | C-k |
| undo | u | C-x u |
| u | C-_ (hold Ctrl, press dash/hypen/underscore key) | |
| redo | r | break out of undo mode, and type C-_ again |
| note: these searches are case insensitive | ||
| search forward | / | C-s (incremental / search-as-you-type) |
| / | C-s, [enter] (non incremental / type whole word, then search) | |
| search backward | ? | C-r (incremental) |
| ? | C-r, [enter] (non incremental) | |
| note: even these *regex* searches are case insensitive. There is a way to make them case sensitive: set the variable `case-fold-search' to `nil'. | ||
| search forward using regex | C-M-s (incremental) | |
| and backward | C-M-r | |
| call out to the shell | ! | M-! (Meta-Shift-1) |
| start a full subshell | M-x eshell |
Notes on differences to vi:
* undo commands wrap around. Once you undo all your edits, the undo command reverses direction and starts re-doing the edits! break out of the undo mode and press C-_ (undo) again to change the direction of undo/redo command.
* files are autosaved to a seperate buffer. to recover after a crash, type: M-x recover-file
Emacs-only commands:
| list commands in help menu | F1, ? |
| get help on key combinations | F1, k, [some key combination] |
| toggle read-only status of the buffer | C-x, C-q |
| get out of a command | C-g |
| redo an edit (undo the undo) | type any harmless character to break out of undo mode. You will now be able to undo your undo commands. |
| remove help window | C-x 1 |
| scroll the help | C-M-v |
| re-map a key | M-x global-set-key [enter] |
Subscribe to:
Posts (Atom)