Tweakers Anonymous       John SJ Anderson            dc.pm          @genehack    genehack@genehack.org
An elegant weapon for a more civilized age
An elegant weapon for a more civilized age
But instead...
But instead...
But instead...
But instead...• Not editor specific
But instead...• Not editor specific• Less about how
But instead...• Not editor specific• Less about how• More about what
But instead...• Not editor specific• Less about how• More about what• Should be able to apply ideas to any  programmer’s ed...
Programmer’s editor
Programmer’s editor• Syntax highlighting
Programmer’s editor• Syntax highlighting• Indentation support
Programmer’s editor• Syntax highlighting• Indentation support• Programable
Syntax highlighting
Syntax highlighting• If nothing else, this helps catch stupid typos  faster
Syntax highlighting• If nothing else, this helps catch stupid typos  faster• Can also sometimes obscure the code -- you  m...
Syntax highlighting• If nothing else, this helps catch stupid typos  faster• Can also sometimes obscure the code -- you  m...
Syntax highlighting• If nothing else, this helps catch stupid typos  faster• Can also sometimes obscure the code -- you  m...
Indentation support
Indentation supportWell, then get one that does do auto-indent.You cant do good work with bad tools. -- Mark Jason Dominus...
Programable
Programable• Doesn’t need to be Turing complete or  anything crazy
Programable• Doesn’t need to be Turing complete or  anything crazy• (Although you may be missing out if it isn’t.)
Programable• Doesn’t need to be Turing complete or  anything crazy• (Although you may be missing out if it isn’t.)• If you...
The generic advice
The generic advice•   Pay some attention to what you’re doing
The generic advice•   Pay some attention to what you’re doing•   Set things up so stuff you do most often can be    done m...
The generic advice•   Pay some attention to what you’re doing•   Set things up so stuff you do most often can be    done m...
The generic advice•   Pay some attention to what you’re doing•   Set things up so stuff you do most often can be    done m...
The generic advice•   Pay some attention to what you’re doing•   Set things up so stuff you do most often can be    done m...
Ever done this?
Ever done this?$ vim my_awesome_script.pl
Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq
Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq$ ./my_awesome_script.pl
Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq$ ./my_awesome_script.plbash: ./awesome_script.pl: permissio...
This is fixable:       auto chmod +xautocmd BufWritePost *.pl !chmod +x %(add-hook after-save-hookexecutable-make-buffer-fi...
Commit messages
Commit messages• Set up $GIT_EDITOR so you can write  commit messages in your editor of choice
Commit messages• Set up $GIT_EDITOR so you can write  commit messages in your editor of choice• emacsclient is particularl...
Commit messages• Set up $GIT_EDITOR so you can write  commit messages in your editor of choice• emacsclient is particularl...
Code Tidying
Code Tidying• Same idea as “make executable on save”
Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run  perltidy, and save the o...
Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run  perltidy, and save the o...
Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run  perltidy, and save the o...
Syntax Checking
Syntax Checking• Beating the same one-trick pony
Syntax Checking• Beating the same one-trick pony• Run ‘perl -c’ after you save
Syntax Checking• Beating the same one-trick pony• Run ‘perl -c’ after you save• Gripe if there are errors
Even Better:Syntax Checking
Even Better:Syntax Checking   On The Fly!
Ill-advised live demo!
Even Betterest:Syntax Checking  On The Fly
Even Betterest: Syntax Checking& Static Analysis   On The Fly
Even more   ill-advisedlive demoing!
Code Browsing
Code Browsing• Emacs calls this find-file-at-point
Code Browsing• Emacs calls this find-file-at-point• ffap!
Code Browsing• Emacs calls this find-file-at-point• ffap!• With add-ons (such as PerlySense) one can  get quite fancy
Documentation        Browsing• Same idea here, really
Auto-Completion
Auto-CompletionWhile it isn’t possible to do this perfectly,you can get closer than you might think...
Auto-CompletionWhile it isn’t possible to do this perfectly,you can get closer than you might think......but it might not ...
Share & Enjoy• My editor config:  https://github.com/genehack/emacs
Thanks!Questions?
First EverDC-Baltimore Perl Workshop       14 April 2012        dcbpw.org
Upcoming SlideShare
Loading in...5
×

Tweakers Anonymous

1,421

Published on

Have you ever spent most of a day getting your editor set up "just right"? Have you justified the time spent on customizing your configuration in terms of the overall productivity gains that are going to result once you remember what key binding you put that new tweak on? Or maybe, whenever you see a tweak described for that _other_ editor, you can't rest until you've duplicated and maybe even expanded upon it for the clearly superior editor you use? If the above hit too close to home -- particularly if you've ever written a program specifically to allow you to more easily deploy your editor configuration on a new machine -- this talk is for you.

We're going to talk about editor tweaks that make writing, testing, running, and otherwise working with Perl faster and easier, so you can focus on the stuff that really matters: beer, go karts, and cool new editor color themes...

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,421
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Tweakers Anonymous

    1. 1. Tweakers Anonymous John SJ Anderson dc.pm @genehack genehack@genehack.org
    2. 2. An elegant weapon for a more civilized age
    3. 3. An elegant weapon for a more civilized age
    4. 4. But instead...
    5. 5. But instead...
    6. 6. But instead...
    7. 7. But instead...• Not editor specific
    8. 8. But instead...• Not editor specific• Less about how
    9. 9. But instead...• Not editor specific• Less about how• More about what
    10. 10. But instead...• Not editor specific• Less about how• More about what• Should be able to apply ideas to any programmer’s editor
    11. 11. Programmer’s editor
    12. 12. Programmer’s editor• Syntax highlighting
    13. 13. Programmer’s editor• Syntax highlighting• Indentation support
    14. 14. Programmer’s editor• Syntax highlighting• Indentation support• Programable
    15. 15. Syntax highlighting
    16. 16. Syntax highlighting• If nothing else, this helps catch stupid typos faster
    17. 17. Syntax highlighting• If nothing else, this helps catch stupid typos faster• Can also sometimes obscure the code -- you may want to be able to easily toggle it on and off
    18. 18. Syntax highlighting• If nothing else, this helps catch stupid typos faster• Can also sometimes obscure the code -- you may want to be able to easily toggle it on and off• Not to the angry fruit salad level
    19. 19. Syntax highlighting• If nothing else, this helps catch stupid typos faster• Can also sometimes obscure the code -- you may want to be able to easily toggle it on and off• Not to the angry fruit salad level• Just something that distinguishes keywords from variables from function names
    20. 20. Indentation support
    21. 21. Indentation supportWell, then get one that does do auto-indent.You cant do good work with bad tools. -- Mark Jason Dominuss Good Advice #11918
    22. 22. Programable
    23. 23. Programable• Doesn’t need to be Turing complete or anything crazy
    24. 24. Programable• Doesn’t need to be Turing complete or anything crazy• (Although you may be missing out if it isn’t.)
    25. 25. Programable• Doesn’t need to be Turing complete or anything crazy• (Although you may be missing out if it isn’t.)• If you can send a selection to an external program and replace the selection with the output, you’re probably set
    26. 26. The generic advice
    27. 27. The generic advice• Pay some attention to what you’re doing
    28. 28. The generic advice• Pay some attention to what you’re doing• Set things up so stuff you do most often can be done most easily
    29. 29. The generic advice• Pay some attention to what you’re doing• Set things up so stuff you do most often can be done most easily• E.g., saving a file, closing a file, defining and running macros, etc. etc.
    30. 30. The generic advice• Pay some attention to what you’re doing• Set things up so stuff you do most often can be done most easily• E.g., saving a file, closing a file, defining and running macros, etc. etc.• The F keys are not there just so you can skip tracks in your MP3 player
    31. 31. The generic advice• Pay some attention to what you’re doing• Set things up so stuff you do most often can be done most easily• E.g., saving a file, closing a file, defining and running macros, etc. etc.• The F keys are not there just so you can skip tracks in your MP3 player• Keep your config in git so you can revert it when you screw it up
    32. 32. Ever done this?
    33. 33. Ever done this?$ vim my_awesome_script.pl
    34. 34. Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq
    35. 35. Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq$ ./my_awesome_script.pl
    36. 36. Ever done this?$ vim my_awesome_script.pl# hack hack hack; !wq$ ./my_awesome_script.plbash: ./awesome_script.pl: permission denied
    37. 37. This is fixable: auto chmod +xautocmd BufWritePost *.pl !chmod +x %(add-hook after-save-hookexecutable-make-buffer-file-executable-if-script-p)
    38. 38. Commit messages
    39. 39. Commit messages• Set up $GIT_EDITOR so you can write commit messages in your editor of choice
    40. 40. Commit messages• Set up $GIT_EDITOR so you can write commit messages in your editor of choice• emacsclient is particularly nice here:
    41. 41. Commit messages• Set up $GIT_EDITOR so you can write commit messages in your editor of choice• emacsclient is particularly nice here: export GIT_EDITOR=‘emacsclient -t’
    42. 42. Code Tidying
    43. 43. Code Tidying• Same idea as “make executable on save”
    44. 44. Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run perltidy, and save the output of that instead
    45. 45. Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run perltidy, and save the output of that instead• If you don’t want to do that, do the world a favor and set up your editor to delete trailing whitespace when you save a file.
    46. 46. Code Tidying• Same idea as “make executable on save”• When you save a file, before the write, run perltidy, and save the output of that instead• If you don’t want to do that, do the world a favor and set up your editor to delete trailing whitespace when you save a file.• Please.
    47. 47. Syntax Checking
    48. 48. Syntax Checking• Beating the same one-trick pony
    49. 49. Syntax Checking• Beating the same one-trick pony• Run ‘perl -c’ after you save
    50. 50. Syntax Checking• Beating the same one-trick pony• Run ‘perl -c’ after you save• Gripe if there are errors
    51. 51. Even Better:Syntax Checking
    52. 52. Even Better:Syntax Checking On The Fly!
    53. 53. Ill-advised live demo!
    54. 54. Even Betterest:Syntax Checking On The Fly
    55. 55. Even Betterest: Syntax Checking& Static Analysis On The Fly
    56. 56. Even more ill-advisedlive demoing!
    57. 57. Code Browsing
    58. 58. Code Browsing• Emacs calls this find-file-at-point
    59. 59. Code Browsing• Emacs calls this find-file-at-point• ffap!
    60. 60. Code Browsing• Emacs calls this find-file-at-point• ffap!• With add-ons (such as PerlySense) one can get quite fancy
    61. 61. Documentation Browsing• Same idea here, really
    62. 62. Auto-Completion
    63. 63. Auto-CompletionWhile it isn’t possible to do this perfectly,you can get closer than you might think...
    64. 64. Auto-CompletionWhile it isn’t possible to do this perfectly,you can get closer than you might think......but it might not be worth the effort
    65. 65. Share & Enjoy• My editor config: https://github.com/genehack/emacs
    66. 66. Thanks!Questions?
    67. 67. First EverDC-Baltimore Perl Workshop 14 April 2012 dcbpw.org

    ×