Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:20:42+00:00 2026-05-30T19:20:42+00:00

I am trying to associate CPerl mode with Perl source files in emacs (23.1.1

  • 0

I am trying to associate CPerl mode with Perl source files in emacs (23.1.1 on CentOS 6).

If I include the following line in my .emacs

(defalias 'perl-mode 'cperl-mode)

then CPerl mode will be loaded when a Perl source file is opened.

However, the following line, which seems like ti should work, results in Perl mode being loaded instead:

(add-to-list 'auto-mode-alist '("\\.p[lm]$" . cperl-mode))

There’s no error message – it just loads Perl mode instead of CPerl mode.

The reason I’m asking is that I’ve had some issues using cperl-set-style (works from the emacs menu but not if I add it as a hook to the CPerl mode when it’s been aliased to perl-mode) and I wanted to try loading CPerl mode directly.

The statement I’m using in my .emacs to set the indenting style as a hook to CPerl mode is

(eval-after-load "cperl-mode" 
    add-hook 'cperl-mode-hook (lambda() (cperl-set-style 'C++))))

This obviously has no effect if CPerl mode is not loaded (when I use the auto-mode-alist approach) and does not do the right thing (seems to use GNU indent style) when I load CPerl mode by aliasing it to Perl mode.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:20:43+00:00Added an answer on May 30, 2026 at 7:20 pm

    You need to use (cperl-set-style "C++") instead of (cperl-set-style 'C++). If you look at the variable cperl-style-alist (e.g. with C-hv) then you will see that the car‘s consist of strings rather than symbols. It seems unfortunate that your example failed silently rather than raising an error. Most of the time I would want to know that I tried to choose a non-existant style, but there’s probably a good reason for it to be the way it is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to add an associate as a tester/developer of our application in sandbox mode
I'm trying to create a trigger that will associate an unique random string to
I am trying to associate multiple files with my app i have done associating
I'm grabbing a list of events from a database and am trying to associate
This is my first time making a hash table. I'm trying to associate strings
I am trying to associate existing records while still being able to add new
I am trying to associate Contacts with Classes but as two different types. Current_classes
I'm trying to associate an SQLite3 database file with our app so that it's
I'm trying to associate a video file to a record with a bunch of
I'm trying to associate information with projects (certain properties). I tried using the persistence

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.