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

  • SEARCH
  • Home
  • 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 8819317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:19:37+00:00 2026-06-14T05:19:37+00:00

It looks that ‘smart-operator’ minor mode is very interesting. The .el could help c

  • 0

It looks that ‘smart-operator’ minor mode is very interesting. The .el could help c programmer to add spaces embrace some kinds of operators, such as turning ‘a+b’ to ‘a + b’. I just gave a shot on it. Except the following problem, it works well. Here is the situation.

As to ‘-‘ operator, it could be used in both ‘a – b’ and ‘-1’, ‘-ENOMEM’ cases. Smart-operator covers the first use case. However, it doesn’t work with the latter. Here is the code related to this part.

(defun smart-operator-- ()
  "See `smart-operator-insert'."
  (interactive)
  (cond ((and c-buffer-is-cc-mode (looking-back "\\- *"))
         (when (looking-back "[a-zA-Z0-9_] +\\- *")
           (save-excursion
             (backward-char 2)
             (delete-horizontal-space)))
         (smart-operator-insert "-" 'middle)
         (indent-according-to-mode))
        (t
         (smart-operator-insert "-"))))

How could I modify the code to get it worked with ‘-ENOMEM’ case?

  • 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-06-14T05:19:38+00:00Added an answer on June 14, 2026 at 5:19 am

    Finally, I got some time to work on this issue. Having the small problem fixed in smart-operator.el is just fun. Paste the patch here for anyone who had the same problem.

    --- a/smart-operator.el 2012-11-10 16:25:27.393138909 +0900
    +++ b/smart-operator.el 2012-11-10 18:22:18.281490742 +0900
    @@ -307,6 +307,10 @@
                  (delete-horizontal-space)))
              (smart-operator-insert "-" 'middle)
              (indent-according-to-mode))
    +   ((and c-buffer-is-cc-mode (looking-back "[*/%+(><=&^|] *"))
    +    (smart-operator-insert "-" 'before))
    +   ((and c-buffer-is-cc-mode (looking-back "\\(return\\) *"))
    +    (smart-operator-insert "-" 'before))
             (t
              (smart-operator-insert "-"))))
    

    All these cases are covered by the patch.

    a = -b;
    a + -b;
    <other binary operators>
    return -ENOMEM;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something that looks like the following: var someList = MockRepository.GenerateStub<IList<ISomething>>(); someList.Add(MockRepository.GenerateStub<ISomething>()); The
Code looks like that #include <cstdlib> #include <iostream> using namespace std; #define n 3;
I have code that looks more or less like the code below but it
My URL currently looks like that http://www.mydomain.com/index.php?videoID=6nR9nsKTx4g but I want to access the page
I have html that looks like this with several items <div class=item> <p class=price>$388.00</p>
I have code that looks like this: obj.foo(); // obj might, or might not
I have class that looks like this: class A { public: class variables_map vm
My console app looks like that. #include stdafx.h #include <iostream> #include <cmath> using namespace
I have code that looks like this: template<class T> class list { public: class
I have something that looks like the following: [CoolnessFactor] interface IThing {} class Tester

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.