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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Perhaps you aren't properly associating cperl-mode with your file. Here's some lisp-fu for you. The file is also available at http://diotalevi.isa-geek.net/~josh/emacs/my-cperl.el

;; Autoloading perltidy (autoload #'perltidy "perltidy" nil t) (autoload #'perltidy-mode "perltidy" nil t) (autoload #'perltidy-unless-readonly-mode "perltidy" nil t) (eval-after-load "cperl-mode" '(add-hook 'cperl-mode-hook #'perltidy-u +nless-readonly-mode)) (eval-after-load "perl-mode" '(add-hook 'perl-mode-hook #'perltidy-u +nless-readonly-mode)) ;; Autoloading perl-syntax (autoload #'perl-syntax "perl-syntax-mode" nil t) (autoload #'perl-syntax-region "perl-syntax-mode" nil t) (autoload #'perl-syntax-mode "perl-syntax-mode" nil t) (defalias 'perlsyntax-mode 'perl-syntax-mode) (eval-after-load "cperl-mode" '(add-hook 'cperl-mode-hook #'perl-synta +x-mode)) (eval-after-load "perl-mode" '(add-hook 'perl-mode-hook #'perl-synta +x-mode)) ;; Autoloading perlcritic (autoload 'perlcritic "perlcritic" "" t) (autoload 'perlcritic-region "perlcritic" "" t) (autoload 'perlcritic-mode "perlcritic" "" t) (eval-after-load "cperl-mode" '(add-hook 'cperl-mode-hook #'perlcritic +-mode)) (eval-after-load "perl-mode" '(add-hook 'perl-mode-hook #'perlcritic +-mode)) (defun perl-interpreter (&rest interpreter-else) (save-restriction (widen) (save-excursion (goto-char (point-min)) (if (looking-at auto-mode-interpreter-regexp) (match-string 2) (car interpreter-else))))) (defun perl (start end) "Runs the current region or buffer with perl" (interactive (if (if (boundp 'mark-active) mark-active (mark)) (list "r") (setq start (point-min)) (setq end (point-max)) (list "i"))) (shell-command-on-region start end (perl-interpreter "perl"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Parrots ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'pasm-mode "pasm-mode" nil t) (add-to-list 'auto-mode-alist '("\\.pasm" . pasm-mode)) (add-to-list 'interpreter-mode-alist (cons "pasm" 'pasm-mode)) (autoload 'pir-mode "pir-mode" nil t) (add-to-list 'auto-mode-alist '("\\.\\(imc\\|pir\\)" .pir-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Pod ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'pod-mode "pod-mode" nil t) (add-to-list 'auto-mode-alist '("\\.pod" . pod-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Associate cperl-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-to-list 'auto-mode-alist '("\\.[Pp][LlMm][Cc]?$" . cperl-mode)) (while (let ((orig (rassoc 'perl-mode auto-mode-alist))) (if orig (setcdr orig 'cperl-mode)))) (while (let ((orig (rassoc 'perl-mode interpreter-mode-alist))) (if orig (setcdr orig 'cperl-mode)))) (dolist (interpreter '("perl" "perl5" "miniperl")) (unless (assoc interpreter interpreter-mode-alist) (add-to-list 'interpreter-mode-alist (cons interpreter 'cperl-mode +)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Associate pod-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-to-list 'auto-mode-alist '("\\.[Pp][Oo][Dd]$" . pod-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Autocomplete ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defadvice cperl-indent-command (around cperl-indent-or-complete) "Changes \\[cperl-indent-command] so it autocompletes when at the en +d of a word." (if (looking-at "\\>") (dabbrev-expand nil) ad-do-it)) (defun cperl-dabbrev-installer () (set (make-local-variable 'dabbrev-case-fold-search) nil) (set (make-local-variable 'dabbrev-case-replace) nil)) (eval-after-load "cperl-mode" '(progn (require 'dabbrev) (ad-activate 'cperl-indent-command) (add-hook 'cperl-mode-hook #'cperl-dabbrev-installer))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Prove ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun cperl-prove () "Run the current test." (interactive) (shell-command (concat "prove -v " (buffer-file-name)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Devel::Graph ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun devel-graph () (interactive) (shell-command-on-region (point-min) (point-max) "perl -MDevel::Graph -0777 -pe '$_=Devel::G +raph->graph(\\$_)'")) (eval-after-load "cperl-mode" '(add-hook 'cperl-mode-hook (lambda () ;;(local-set-key "\C-cp" 'cperl-prove) ;;(local-set-key "\C-cdg" 'devel-graph) (local-set-key "\C-ctp" 'toggle-test-plan) ))) (defun toggle-test-plan () (interactive) (let ((new-pos)) (save-excursion (goto-char (point-min)) (cond ((re-search-forward "More[ \t]+tests[ \t]*=>[ \t]*" nil t) (replace-match "More 'no_plan'; # tests => " t t)) ((re-search-forward "More[ \t]+'no_plan';[ \t]*#[ \t]*" ni +l t) (replace-match "More " t t) (setq new-pos (point))))) (if new-pos (goto-char new-pos))))

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊


In reply to Re: Emacs and perltidy-mode by diotalevi
in thread Emacs and perltidy-mode by silent11

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (14)
    As of 2014-12-22 18:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (126 votes), past polls