Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

[EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016

by LanX (Archbishop)
on Jul 09, 2016 at 16:33 UTC ( #1167507=perlmeditation: print w/replies, xml ) Need Help??

UPDATE:

In the meantime the talk took place, here the links:

Original Post

Here the abstract for my talk proposal for Cluj

... not sure if it's too late to be still accepted

Comments and corrections are welcome

Emacs offers even more ways to do it than Perl's TIMTOWTDI .

This demonstration will show how to combine some .el packages to create a neatly integrated and productive Perl development environment. (well from the authors perspective)

Intended audience : Emacs users trying to navigate thru all these possibilities.

After a short introduction into emacs (v24) for non-users we'll concentrate on builtin Perl support and how to add some other language agnostic projects to approach the author's IDE of what an IDE should look like.

For starters: Overview of Emacs goodies (and some myth-busting)
  • open source
  • available on all development platforms
  • runs in windows and TTY
  • start-up time and memory consumption comparable to Vim ( != vi) just try emacs -nw -Q
  • package management for a huge universe of extensions
  • CUA shortcut emulations for "modern" applications (C-x C-v C-z C-a ...)
  • VIM command emulation evil-mode (includes text objects)
  • regional undo Undo only in selected text.
Out-of-The-Box support

What comes already builtin for Perl?

** cperl-mode

The Standard mode for Perl features, including

  • imenu easy navigation for subs
  • auto indentation
  • code transformation prettifying regex convert postfix <-> prefix for "if" , "unless", etc
  • compile options
  • formatting options akin to perltidy
  • documentation display
** perldb

Perl debugger integration, stepping through original file

** flymake-mode

Interactive syntax check while typing by running "perl -c" in background

** dabbrev-mode

avoid typos of identifiers by expanding from dynamic abbreviation dictionary

Recommended Extension Packages

** Yasnippet

Yasnippet (Yet Another Snippet Package) emulates the Textmate snippet features, which seem to become a standard now across all IDEs

** Auto Complete

auto-complete.el shows completion alternatives in drop-down while typing from different sources (functions, variables, snippets,...)

** (Omni Complete)

probably covered, this is a very promising project but yet not personally tested

** ECB = Emacs Code Browser

The IDE "look an feel" with many specialized information panes to explore

link: http://ecb.sourceforge.net/

** Regex-tool

A tiny project to interactively test Perl-regexes against text an see the resulting matches.

Demonstrates the extensibility of emacs.

Visions

** PIDE I - "Perl Integrated Development for Emacs"

combining a stable set-up of Perl related el-modules and configs for a quick start with Emacs.

** PIDE II - "Perl Integrated Development for Every editor"

Is an editor agnostic framework possible?

Snippets and Completion-rules could be provided in POD "=for IDE" to support different projects like Moose or Mojolicious or whatever. A simple script could parse them on editor start-up and translate them to editor specific syntax.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016
by Laurent_R (Canon) on Jul 10, 2016 at 11:02 UTC
    The deadline for submitting talks is July 15th, 2016, so you should be OK.

    No sure yet if I'll make it to Cluj, but if I do, I'll be interested with your talk, even though I haven't used Emacs for ages.

      This time they already accepted a big part of submitted proposals (which is a good idea), so there are not many slots left.

      Posting it here is a good alternative, if there is a consecutive discussion.

      Pdf of slides including screenshots will follow soon.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        I'm using GNU Emacs as my Perl "IDE" of choice (so do a couple of other developers at my company), so I would be very interested in your talk.
Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016 (VIDEO)
by LanX (Archbishop) on Sep 11, 2016 at 12:50 UTC

      Thanks for this, it's a shame the audio isn't clearer.

        > , it's a shame the audio isn't clearer

        could be partly my fault, I wanted to have the hands free and fixed the micro at my badge. (Though the audience heard me well over the speakers ... )

        And probably my netbook is interfering with the signal.

        I'm no sound engineer but couldn't this be filtered?

        Can't blame anyone, since YAPC 2012 I know how complicated good recordings are.

        Organizers need to find a solution to mix and synchronize 3 signals (camera, sound and projector) for low budget.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016
by Erez (Priest) on Jul 18, 2016 at 08:41 UTC
    Just a few remarks:

    perldb

    Never used it inside emacs, (and hardly outside it), how well integrated is it with emacs? Do you have the ability to jump from a debug line to the source file?

    flymake-mode

    I prefer flycheck to flymake, but in either case, I have major issues with these, since my setup (everything is in local::lib), gives me "module not found" errors. I've tested several solutions, but haven't found one that 100% works.

    Yasnippet

    Not my style of programming, but a good recommendation for those who use it

    Auto Complete

    Excellent package, very robust. I know some also like company-mode, which can be used to force a code-style across the company (hence the name), which is a good counter argument to those that claim perl is unsuitable for large companies/projects.

    ECB = Emacs Code Browser

    Is this really beneficiary for perl programming? There is also the perl-critic library (available from the Perl-Critic page. A search for emacs yields a ton of results. As for the vision, I just don't thing perl needs an IDE. These, and other, tools definitely help. Utilising Org-Mode and Babel for project management, documentation etc. is a very strong tool (Org-mode is emacs killer app), but generally a full-blown IDE is just overkill for a language like perl.

    Principle of Least Astonishment: Any language that doesn’t occasionally surprise the novice will pay for it by continually surprising the expert

      Hooray a discussion! :)

      First, let me say that the term "IDE" is very poorly defined (see my old discussion ) and the individual requirements vary immensely.

      The beauty of Emacs is its scalability as a weapon to attack problems, from light dagger to heavy battle cruiser. Otherwise I would recommend something like Komodo.

      perldb

      > Never used it inside Emacs, (and hardly outside it)

      Neither do I, well as long as I have full control of the code. Stepping with breakpoints can be very handy with foreign code

      > Do you have the ability to jump from a debug line to the source file?

      The source file is always visible and the current line marked.

      like here http://www.khngai.com/emacs/emacsperl.gif

      There is also perldb-ui.el but I haven't tested it yet. see perldb.png

      flymake-mode

      > have major issues with these, since my setup (everything is in local::lib), gives me "module not found" errors.

      that's not the editors fault, you either have to define lib with the of perl -c command like you would on the command line or set up use lib properly.

      Yasnippet

      > Not my style of programming,

      Well I'm very critical of boilerplating, most problems could be better solved with appropriate modules.

      But textmate's snippet format also comes with the ability to include interactive code (elisp or Perl calls or...) and choice menus (like e.g. 'rw', 'ro', ... for Moose attributes)

      It offers an open standard for extensions which is editor agnostic.

      Auto Complete

      > I know some also like company-mode,

      I have to look into this...

      > which can be used to force a code-style across the company (hence the name), which is a good counter argument to those that claim perl is unsuitable for large companies/projects.

      Doesn't this contradict your later claim that Perl doesn't need an IDE??? ;-)

      ECB = Emacs Code Browser

      > Is this really beneficiary for perl programming?

      1. Many people identify IDE with a certain Eclipse_(software) "look", with different panes. The graphical experience of different panes gives them the feeling of uncharted territories to explore.

      Having a pane where all subs are listed is certainly beneficial for a beginner who doesn't know how to activate imenu .

      And we have to admit that in the learning phase clicking on an icon and experimenting is easier than reading documentation.

      2. ECB is neatly addressing the second biggest problem² of Emacs, the window management (it took me ages before I discovered winner-undo). You can define your personal layout(s) and the editing panes will never be destroyed or divided. All compilation output and occur parsing and other things will be directed to the compilation window only.

      3. ECB comes with an overhead but I only activate it when needed (please try to use something like Komodo on a netbook or over SSH on a TTY) and I switch between different self defined layouts (like one showing the currently important file from my testsuite with result).

      Vision

      > As for the vision, I just don't thing perl needs an IDE.

      Emacs is not an IDE it's an IDE construction set!

      TIMTOWTDI and heaving a bundle which can be easily customized for your personal needs could be beneficial for Emacs users and the Perl community in total.

      I don't have hubris to solve anyone's personal requirements, I want to have the basis for a solid discussion.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

      ==== footnote

      ²) the first being the byzantine key bindings

        > which can be used to force a code-style across the company (hence the name), which is a good counter argument to those that claim perl is unsuitable for large companies/projects.

        Doesn't this contradict your later claim that Perl doesn't need an IDE??? ;-)

        I like your line of reasoning. As I should state, this boils down to personal preference. I have worked in languages and technologies that are near unusable without an IDE. In many ways, it's also because the environment (read: Windows) doesn't support many of the userspace tools readily available to *NIX users, like grep, or has no readily-available way of printing out data-structures to STDOUT (e.g. Data::Dumper), and if and when you do inspect structures, they are unreadable.

        Perl, OTOH, can dump any structure at any point, and you can always figure out "what does perl think X is" which is basically what you need debugging for. There's also less need of the "Intellisense" feature since you're not dealing with tens of thousands of classes and methods, and the libraries you choose have usually a simple and well documented API (yey CPAN Kwalitee).

        As for company-mode and code style, I don't think this is an integral part of an IDE. It's more of a feature of existing IDEs, and you can accomplish the same in many other editors and tools, without having to lock-in to an IDE.

        Emacs is not an IDE it's an IDE construction set!

        That is definitely *the* selling point of emacs, and you can construct it to better suit your needs. Whether you want a debugger, or a code-style, or some sort of CI, it's all available in emacs. You can also integrate emacs with a bug-tracker or similar, and I again point to Org-mode as an excellent project management tool. Also, it has one of the better git integration with magit, which can be seriously helpful in development.

        Come to think about it, I would say that, while perl doesn't need an IDE, software development of large projects or in a large company does need a lot of tools to assist the streamlining of the development, and emacs has all of those, and then some.

        Principle of Least Astonishment: Any language that doesn't occasionally surprise the novice will pay for it by continually surprising the expert

      The perldb works really well inside of emacs: you get a two window display, one window shows the shell/REPL area where you type debugger commands and the other shows the code it's tracing, with a "=>" superimposed, pointing at the next line that will be executed.

      A screen shot: http://obsidianrook.com/devnotes/talks/perl_debugger/Images/emacs_perldb_big_color_screen.jpg

      It's not the main way that I debug things, but if I'm feeling completely at sea about what some code is doing, playing with perldb is one of the tricks I might used to get oriented.

      The "m" command is particularly interesting: it gives you a list of all available methods on a class or object. It's not very easy to get that information in any other way.

      I wrote a tutorial on using it a long time ago (it's a bit dated, and probably a bit long).

        Speaking of REPLs, I've been using Reply for a good while now (especially with plugins,) and thankfully there's an Emacs frontend for it.

        The perldb works really well inside of emacs

        That's very nice to know. I've probably never used the perdb in my work, but I do appreciate its existence and that it works well within emacs.

        Principle of Least Astonishment: Any language that doesn’t occasionally surprise the novice will pay for it by continually surprising the expert

        Hey Joe, nice to read you again! :-)

        You might want to put your ink into [...] to make it clickable.

        I wanted to "borough" one or two of the quotes from your old talk if it's OK! ;-)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

      > Auto Complete ... I know some also like company-mode

      These two modes are very similar and do basically the same.

      Their usefulness heavily depends on the configured provider back-ends (so called "omni-completion" )... and from what I see both don't bring notable Perl support out of the box.

      At least plsense builds on auto-complete to provide Perl omni-completion.

      But if you have details on why to prefer the one over the other, I'd be interested to hear them.

      > I prefer flycheck to flymake,

      IMHO fly-make is build in, that's why I use it. The intention of my talk is to give an overview, people are free to experiment and contribute better solutions.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

      > flymake-mode

      > I prefer flycheck to flymake,

      So I tried it out via package install ( which is very cool compared to former times, installing el-packages with dependencies like CPAN does -> MENU > Options > Manage Emacs Packages )

      my first impression was bad it was pretty slow ... till I realized that it's also running perlcritic in the background.

      after temporarily deactivating Perlcritic ( M-x customize-group flycheck > Flycheck Checkers ) it worked smoothly and looks easier to maintain! :)

      Will still have to look into optimizing the appearance ...

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        I occasionally have my windows-emacs hanging several seconds when using flycheck

        according to the maintainer

        > ... I am sorry, but as said before we do not support Windows. As such, please understand that we do not want to document Windows-specific bugs and issues in our documentation.

        I think it's safe to resort to flymake then.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        update

        probably my perceived problems with perlcritic blocking were just Windows related...

Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016 (SLIDES)
by LanX (Archbishop) on Aug 29, 2016 at 17:06 UTC
Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016
by Cow1337killr (Monk) on Jul 15, 2016 at 00:43 UTC
Re: [EMACS] "Emacs as Perl IDE" - Abstract for YAPC::EU 2016
by zakame (Pilgrim) on Sep 13, 2016 at 05:26 UTC

    Haven't logged in for ages, until now just to express approval for this talk!

    You might want to look into other tools, such as perltidy.el to use Perl::Tidy under emacs; also, if you're using the Helm incremental completion framework, helm-perldoc.el is very useful for perldoc lookup.

    Beyond Perl support, also check out Magit for an Emacs Git UI, and Projectile for project management.

      Oh, thank you, you're too kind! :)

      > You might want to look into other tools, ...

      Thanks, I'll check them out, especially projectile. :)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1167507]
Approved by marto
Front-paged by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2019-07-23 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (24 votes). Check out past polls.

    Notices?