Subject: bug#6013: [cperl-mode] cperl-perldoc doesn't work anymore with file test operators like -e

From: Stefan Kangas <[email-masked]>
Date: Fri, 5 Jul 2019 21:10:28 +0200

tags 6013 patch
thanks

LanX <[email-masked]> writes:

> Hi
>
> cperl-mode can't call perldocs for functions with a hyphen anymore like "-e" or "-X"
>
> (cperl-perldoc "-e") or "M-x cperl-perldoc RET -e" result to
>    "error in process sentinel: Man-bgproc-sentinel: Can't find the -e manpage"
>
> But perldoc -f -e works fine in the shell, and as far as I can see from the sources of cperl-mode "-e" this case is covered to be mapped on the -f switch.
>
> Tested on 23 and 22 from two different users on different continents.
>
> Cheers
>   Rolf

I can confirm this bug, and have attached a fix.

This is tested only on one continent.

Best regards,
Stefan Kangas
From 0025bfde027cbcd2d1fee6f0b9429a84c4770ac2 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Fri, 5 Jul 2019 20:53:53 +0200
Subject: [PATCH] Fix looking up functions like "-e" in cperl-mode

* lisp/progmodes/cperl-mode.el (cperl-perldoc): Handle functions with
leading dash (e.g. "-f"). (Bug#6013)
---
 lisp/progmodes/cperl-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 254269ddf1..6970b5ec84 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -8382,7 +8382,7 @@ cperl-perldoc
   (require 'man)
   (let* ((case-fold-search nil)
 	 (is-func (and
-		   (string-match "^[a-z]+$" word)
+		   (string-match "^\\(-[A-Za-z]\\|[a-z]+\\)$" word)
 		   (string-match (concat "^" word "\\>")
 				 (documentation-property
 				  'cperl-short-docs
-- 
2.11.0