unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Minor enhancement to font-look keywords of perl-mode
@ 2005-03-22 17:01 JUAN-LEON Lahoz Garcia
  2005-03-22 19:46 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: JUAN-LEON Lahoz Garcia @ 2005-03-22 17:01 UTC (permalink / raw)



Hi.

When perl-mode decides to fontify variables and functions by looking
at the syntax prefix ($ or &) in a word, it does not take into account
that maybe the variable or function can be of an external module.

So in expresions "$Foo::bar" or "&Foo:bar" only "Foo" is
fontified. This looks ackward when editing code where such programming
practices are followed.

Following patch solves this, IMHO. Maybe someone in this list can
review and/or apply it.

Regards
juanleon

--- perl-mode.el.~1.52.~	Mon Feb 28 00:13:19 2005
+++ perl-mode.el	Tue Mar 22 17:45:24 2005
@@ -207,10 +207,10 @@
     '("\\<\\(local\\|my\\)\\>" . font-lock-type-face)
     ;;
     ;; Fontify function, variable and file name references.
-    '("&\\(\\sw+\\)" 1 font-lock-function-name-face)
+    '("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
     ;; Additionally underline non-scalar variables.  Maybe this is a bad idea.
     ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face)
-    '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face)
+    '("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)
     '("\\([@%]\\|\\$#\\)\\(\\sw+\\)"
       (2 (cons font-lock-variable-name-face '(underline))))
     '("<\\(\\sw+\\)>" 1 font-lock-constant-face)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Minor enhancement to font-look keywords of perl-mode
  2005-03-22 17:01 Minor enhancement to font-look keywords of perl-mode JUAN-LEON Lahoz Garcia
@ 2005-03-22 19:46 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2005-03-22 19:46 UTC (permalink / raw)
  Cc: emacs-devel

> -    '("&\\(\\sw+\\)" 1 font-lock-function-name-face)
> +    '("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
>      ;; Additionally underline non-scalar variables.  Maybe this is a bad idea.
>      ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face)
> -    '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face)
> +    '("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)

Installed, thanks.  I also correspondingly updated the regexp below:

>      '("\\([@%]\\|\\$#\\)\\(\\sw+\\)"
>        (2 (cons font-lock-variable-name-face '(underline))))
>      '("<\\(\\sw+\\)>" 1 font-lock-constant-face)


-- Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-22 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-22 17:01 Minor enhancement to font-look keywords of perl-mode JUAN-LEON Lahoz Garcia
2005-03-22 19:46 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).