Emacs, a performant IDE for Perl
Upcoming SlideShare
Loading in...5
×
 

Emacs, a performant IDE for Perl

on

  • 6,780 views

Emacs is much more than a source code editor : it provides a rich integrated development environment for Perl developers. This guided tour will show how to take advantage of Emacs basic features ...

Emacs is much more than a source code editor : it provides a rich integrated development environment for Perl developers. This guided tour will show how to take advantage of Emacs basic features (modes, abbreviations, autocompletion, macros, directory editor, undo, etc.), how to run and debug within Emacs, and how to integrate with external utilities such as ctags, ack, perltidy, perlcritic, subversion.

Statistics

Views

Total Views
6,780
Views on SlideShare
6,762
Embed Views
18

Actions

Likes
1
Downloads
50
Comments
0

3 Embeds 18

http://www.slideshare.net 13
http://master-kerstin-puschke.env.xing.com:3007 4
http://sandbox-kerstin-puschke.env.xing.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Emacs, a performant IDE for Perl Emacs, a performant IDE for Perl Presentation Transcript

  • Emacs, a performant IDE for Perl Tutorial for YAPC.:EU:::2009, Lisbon [email_address] Département Office
  • Overview
    • Intended audience
      • Emacs newcomers
      • [ seasoned Emacs users … may find some additional tips ]
      • curious …
    • Topics
      • Intro
      • Emacs concepts
      • General editing
      • Perl programming
      • External tools
      • Emacs-Perl integration : extension packages
  • What is Emacs ?
    • "Emacs is the extensible, customizable, self-documenting real-time display editor".
      • advanced : provides much more than simple insertion and deletion. It can control subprocesses, indent programs automatically, show two or more files at once, and edit formatted text.
      • self-documenting : can type C-h at any time to find out what the options are.
      • customizable : thousands of variables
      • extensible : internal Lisp interpreter
      • feature-rich : thousands of commands
  • Emacs history
    • early 1970s : initial work on PDP computers (MIT Labs)
    • 1976 : first release
    • 1981 : Gosling Emacs on Unix
    • 1986 : GNU Emacs 15.34
    • 1991 : XEmacs fork (formerly Lucid Emacs)
    • 2008: GNU Emacs 22.3
  • Emacs main concepts
    • buffer : basic editing unit (text being edited). Can be bound to various contents like :
      • file (local/remote)
      • computed content (listings, compilation results, shell, email, etc.)
      • external process
    • window : screen area for displaying buffer content
    • frame : OS window
    • mode : set of options for editing some kind of content
      • major mode : mutually exclusive
      • minor mode : additional options (plugin)
  • Other concepts
    • region : portion of buffer between mark and point
    • rectangle : rectangular area instead of linear text
    • register : memory for storing text / position / rectangle
    • macro : recorded sequence of keys
    • desktop : saved Emacs session
  • User input
    • Input events
      • character events
      • modifiers : <CTRL>, <ALT>, <META>, <SUPER>
      • mouse, scroll, click, focus, etc.
    • Key sequence
      • prefix key  keymap. Ex:
        • C-x General extended commands
        • C-h Help commands
        • C-c Mode-specific extended commands
      • complete key  command
    • Keymap
      • binding key  command
      • global / local
  • Entering commands/args in minibuffer
    • Auto-completion
    • Default argument
    • Editing (cut/paste/move/etc.)
    • Command history
  • Modes may implement …
    • additional commands
    • local implementation for generic operations
      • ex: comment-region, indent-region
    • syntax highlighting
    • local keymaps
    • local menus
    • modifications to the display (ex. status line)
    • hooks
  • Editing
    • Move
      • by character, word, sentence, paragraph, page
    • Copy / Cut / Paste
      • kill ring : history of killed fragments
    • Search / Replace
      • incremental / regex
      • word search (without regard to punctuation)
      • clever case substitutions
      • recursive edit
    • Abbrevs
    • Undo
  • Files
    • File names / completion / disambiguation
    • Remote files (ange-ftp / tramp)
    • Archives / compressed files
    • Mode chosen automatically from name or content
    • Bookmarks (filename / position / comment)
    • Shadowing (automatic replication)
    • Filesets
  • Editing directories
    • listing
    • create / rename / delete
    • bulk operations (mark / regexp )
    • open subdirectories in same buffer
    • chmod, mkdir, etc.
    • exec shell command on file(s)
  • Shell
    • Inferior process
      • filename completion
      • history ring
      • editing command-line
      • directory tracking
      • remote host (telnet, rlogin, etc)
    • Eshell
      • no process, all done in Emacs
  • Help
    • Info (manual)
    • Help on
      • variables
      • functions
      • keys
      • bindings
      • mode
      • apropos
  • Programming modes : generic features
    • Recognize top-level definitions
      • go to begin / end, set region (C-M-h), imenu
    • Indentation
      • clever syntax parsing; various indent styles (K&R, BSD, Gnu, etc.)
    • Balanced parentheses
      • begin / end, up / down, kill,
        • (C-M-LEFT, C-M-UP, ..)
      • blink-matching
    • Comments
      • insert, realign, comment / uncomment region, reformat
    • Syntax highlighing
    • Restricting editing scope
      • hideshow minor mode
      • narrowing
        • (C-x n d / w)
    • Autocompletion
    • Electric characters
      • automatic reindent / newline
    • Tags support
  • Cperl mode
    • based on C-mode
      • indenting
      • electric parentheses
      • automatic expansion (if, else, while, do, foreach, …)
      • syntax highlighting
      • binding to perlinfo
      • menu, tools
      • perldb : gud bindings
        • next / step
        • break (C-x SP)
  • Compiling and testing
    • Compilation
      • launch compiler subprocess (&quot;perl&quot;, &quot;gcc&quot;, &quot;make&quot;, etc.)
      • mod-compile.el : additional layer
        • adapt compilation command to current language / context
      • parse errors and navigate to source files
      • usual Emacs commands for viewing results / debug logs
    • GUD (Grand Unified Debugger)
      • shell buffer
      • navigate to source files
  • Searching
    • builtin support for &quot;grep&quot;
    • ack.el : adaptation for &quot;ack&quot;
    • navigate in matched files like for the compilation buffer
  • Autocompletion
    • Static sources
      • Tags
      • Language-specific doc
    • More context-aware
      • Emacs extensions : Sepia, PerlySense
    • Dabbrev
      • most recent, preceding word for which this is a prefix
      • if none, search following words
      • if none, search other &quot;friend&quot; buffers
    • Hippie-expand
      • ring of try functions
        • try-complete-file-name
        • try-expand-all-abbrevs
        • try-expand-line
        • try-expand-dabbrev
        • try-expand-whole-kill
  • External filters
    • Ex: perltidy
      • ; tidy perl code on region
      • (defun perltidy ()
      • &quot;run perltidy on the current region or buffer.&quot;
      • (interactive)
      • (shell-command-on-region (point) (mark)
      • &quot;perltidy -q&quot; nil t))
      • (global-set-key &quot;C-ct&quot; 'perltidy)
  • Version control
    • generic version control (VC)
    • psvn.el : SVN support
      • status
        • dired-like
      • log
      • ediff
    • similar modes for git
  • Differences / patches
    • ediff-mode
      • both versions side-by-side (horizontal or vertical)
      • ediff commands
        • previous / next
        • copy A  B / B  A
      • apply patches (multifiles OK)
  • perlcritic
    • mode perlcritic.el distributed with Perl::Critic
      • apply on buffer
      • apply on region
      • parse output
    • other solution: treat as a standard compile command
      • must configure .perlcriticrc so that Emacs understands filenames
      • verbose = %f:%l:%c: %m, %e (%p, severity %s)
  • Emacs::EPL
    • Perl-Emacs IPC integration, followup to &quot;Perlmacs&quot;
    • looks like this was very nice work
      • adapted environment for running Perl under Emacs
        • redefine STDIN, STDOUT as hooks to Emacs minibuffer
        • populate ENV
      • can write Emacs modules in Perl instead of elisp !
    • last distribution dates back to 2001, using Perl 5.004
    • couldn't get it to work 
  • Devel::PerlySense
    • Perl process in the background
    • Lots of features
      • links to doc
      • class hierarchy analysis and method analysis
      • jump to definition / class
      • run / debug
      • run tests
      • interact with ack
      • notion of &quot;project&quot;
      • file templates
    • but very CPU-intensive and slow 
  • Sepia
    • last distrib May 09
    • Inspired by Emacs Lisp dev. philosophy
    • Features
      • completion on partial words, i.e. L:U  List::Util
      • inferior Perl process with REPL loop
      • analyses opcodes
      • links to doc, to func definitions, to modules
    •  only recognizes core modules/functions
      • didn't figure how to let it read perl/site/lib !
  • Emacs::PDE
    • last distrib July 2008
    • Features (pde-load)
      • projects
      • smart compile (C-c r) / debug
      • tags / menus / tree view (C-c C-v TAB)
      • perldoc integration with browser (C-c C-v RET, C-c C-v C-p)
      • special indenting mode
      • integrate with perltidy / perlcritic
      • interactive perl shell
    •  no install problems
    • need to learn more