Hot answers tagged

8

Updated Solution There is a built in way to do this with font-lock (thank you sanityinc) This answer has all the details about how this style of font-lock-keywords work: https://stackoverflow.com/a/14675550 (defun pod-comment-highlighter (limit) "If looking after __END__ or __END__ is before LIMIT, set match-data to a the location of the pod comment." ...


4

The answer is that you can't do it "right". But you can do the following: (defalias 'my/perl-syntax-propertize-function (syntax-propertize-rules ("\\('\\)[bh]" (1 ".")))) (add-hook 'perl-mode-hook (lambda () (add-function :before (local 'syntax-propertize-function) #'my/perl-syntax-propertize-function))) ...


3

(use-package flycheck :ensure t :init (global-flycheck-mode) (setq flycheck-perl-include-path '("/home/your/path/lib" "/home/your/other/path/lib")))


3

Using the recommendations of @Constantine, here is an improved version of the function: (defun get-perl-id-at-point () (interactive) (let ((beg nil) (end nil)) (if (looking-at "[A-Za-z0-9:_]*?(") (setq end (- (match-end 0) 1))) (if (looking-back "[-+=*/;[:space:]][A-Za-z0-9:_]*?" (- (line-beginning-position) 1)) (setq beg (+ (...


2

You can always turn syntax highlighting back on using M-x font-lock-mode. Using the same command a second time will turn it back off. If you've got it bound to a key that you've inadvertently pressed, use Ctrl+h w font-lock-mode to find which key it's bound to. If you want to set font-lock-mode permanently for cperl, you can do so by setting either cperl-...


2

So I did some more digging and I was able to find a solution, but not a very clean one. I copied the perl-syntax-propertize-function from perl-mode.el. I then added this to my .emacs and changed the name to my/perl-syntax-propertize-function and added the following code after syntax-propertize-rules ("\\('\\)b[^'a-z]" (1 ".")) I then added a perl-mode-hook ...


2

I think it's just a bug in perl-mode. The definition below should fix it: (defun perl-electric-noindent-p (_char) (unless (or (bolp) (eolp)) 'no-indent)) Should be fixed in Emacs-26.


2

I just wrote a company back-end for PlSense. You can find it here. Note that it is still very new but it works great for me!


2

cperl creates abbreviations for perl keywords into ~/.emacs.d/abbrev_defs that trigger function cperl-electric-keyword that does the expansion. To remove the offending entries, call M-x edit-abbrevs, remove the lines you want, save, and press C-c C-c to activate the changes.


2

The package highlight-refontification visualizes how font-lock refontifies a buffer. In this case, it starts at the line where the point is. One way to handle this is to add a function to font-lock-extend-region-functions to expand the region to include the full heredoc comment. One thing that is curious is that the highlighting becomes correct when ...


1

You can also set include paths per project or directory. Add a directory local variable flycheck-perl-include-path with a list of directory strings. Or just create a .dir-locals.el file with ((cperl-mode (flycheck-perl-include-path . ("../lib/" "path/to/you/lib"))))


1

;; Enable/disable perlcritic-mode (setq perlcritic-mode (if (null arg) ;; Nothing! Just toggle it. (not perlcritic-mode) perlcritic-mode toggles itself when you pass it no arguments, but you really just want to enable, so you could do something like this in your .emacs: (defun turn-on-perlcritic-mode () (perlcritic-mode +...


1

Since it looks like cperl-mode always rewrites its abbreviations, my previous answer is not a long term solution. A better solution is to run a hook after cperl has been loaded and redefine the cperl-mode-abbrev-table. Add it to your emacs configuration file after other commands modifying cperl. I've removed the loop abbreviations from the redefined table, ...


1

These elisps may help you: https://github.com/kentaro/perlbrew.el https://github.com/dams/perlbrew-mini.el They seems to be pretty old, so please check them (I myself don't use perlbrew).


1

You can customize the command run by perldb by changing gud-perldb-command-name. Its default value is set to "perl -d".


1

It seems like this behavior is related to the newest version of cperl-mode. I am using Emacs 24.4 on Ubuntu 14.04, and the cperl-mode that came with the installation (/opt/emacs24.4/share/emacs/24.4/lisp/progmodes/cperl-mode.el.gz) is version 6.1 of cperl-mode. I then tried to install cperl-mode from ELPA using Emacs 24.4 package manager (list-packages), ...


Only top voted, non community-wiki answers of a minimum length are eligible