perly-sense-mode
is s minor mode for Emacs that acts as an interface for the
suite of Emacs tools housed in the Devel::PerlySense perl package on CPAN.
To use perly-sense-mode
, you need:
- The
Devel::PerlySense
CPAN package (you can haveperly-sense-mode
try and install it for you, but this is experimental).
NOTE: This package is not yet hosted on MELPA. I will update this README as
soon as it becomes available. Until then, here are some other ways of
installing perly-sense-mode
:
Using straight.el
(straight-use-package
'(perly-sense-mode :type git :host github :repo "tjtrabue/perly-sense-mode"))
Clone this repository:
git clone [email protected]:tjtrabue/perly-sense-mode.git
Once you’ve finished cloning the repository, add it to your load-path
in
your ~/.emacs
file (or whichever initialization file you use):
(add-to-list 'load-path "/path/to/perly-sense-mode")
It’s a good idea to set these variables before you load the
perly-sense-mode
plugin.
;; Change the keybinding for the PerlySense prefix key:
;; This is the most important setting.
(setq ps/key-prefix (kbd "C-c C-o"))
;; Set this value to t if you would like to use flymake.
;; Not recommended since flymake is deprecated in favor of flycheck.
(setq ps/load-flymake nil)
Add the following hooks to your Emacs configuration file:
(add-hook 'perl-mode #'perly-sense-mode)
(add-hook 'cperl-mode #'perly-sense-mode)
Although it is recommended that you already have Devel::PerlySense
installed on your system before using perly-sense-mode
, this plugin does
provide an autoloaded function called install-perly-sense
that you can use
to try and install Devel::PerlySense
from within Emacs. Here is an example
workflow using this feature:
;; Load perly-sense-mode:
(require 'perly-sense-mode)
;; Add major mode hooks:
(add-hook 'perl-mode #'perly-sense-mode)
(add-hook 'cperl-mode #'perly-sense-mode)
;; If the perly_sense executable is not found on $PATH, try and install it:
(install-perly-sense)
Again, it is recommended that you install Devel::PerlySense
manually using
cpanm
, so use this feature at your own risk.
Devel::PerlySense
already contains all the Emacs Lisp code necessary to use
its features, which is very handy, but configuring your ~/.emacs
file to tap
into those functions has always been an awkward copy-and-paste procedure that
is prone to error. Not only that, but making sure that the Elisp code for
PerlySense
only loads for perl-mode
and cperl-mode
requires further
customization. This minor mode fixes these issues by providing an interface
that handles all of the automatic loading/unloading for you. All you need to
do is add a hook for perl-mode
and/or cperl-mode
to start
perly-sense-mode
automatically and you’re golden!