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 8890399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:29:35+00:00 2026-06-14T22:29:35+00:00

I’m a C++ programmer using a setup consisting of cc-mode and CEDET and of

  • 0

I’m a C++ programmer using a setup consisting of cc-mode and CEDET and of course our beloved emacs (v24.2).

A feature I’m missing is a function that moves point fast through a list of arguments. Consider this example:

void takesManyArgs( int a1, int a2, int a3, std::pair<int,int> a4, int a5 ){  
    // does something nifty!  
}  
// [...]
takesManyArgs( b1, b2, b3, make_pair( b4, b5 ), b6 );

Where point is just before the first int. Now I’d like to an easy way to quickly move through the list of arguments, i.e. a forward-argument (and backward-argument aswell) function that moves right before the first non-whitespace character past the comma (the argument separator).
I have written a small function that does it but it’s not quite the way I’d like it work:

(defun arg-forward ()  
  "Move point forward in the file until we hit an argument separator, i.e. comma, colon or semicolon."  
  (interactive)  
  (progn  
    (re-search-forward "[,]")))  

In principle this function just jumps to the next comma. That’s not the behaviour I want.

I’d like a function that:

  • Edit: Jumps to the next argument separator (i.e. comma for C++) and places point just after that argument separator
  • Checks whether there’s a whitespace after the comma; in case there’s one, point is moved to the first non-whitespace character (i.e. instead of ,| int it will look like , |int where | marks point)
  • Stops at the end of the argument list and prints a message (e.g. “At end of argument list”)
  • Stays within its “scope”, i.e. it’ll go from |int b3 to |make_pair( int b4, int b5 ) to |int a6 where | marks point

Any help from you elisp “hackers” is appreciated!

Edit: Added some clarification.
Edit2: Fixed that example “Code”

  • 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-14T22:29:36+00:00Added an answer on June 14, 2026 at 10:29 pm

    This function seems to do what you requested:

    (defun arg-forward ()
      "Move point forward until we hit an argument separator, the comma, colon, semicolon"
      (interactive)
      (condition-case nil
          (let ((separator-regexp "[,:;]"))
            (forward-sexp)
            (while (not (or (looking-at (format "[ \t]*%s" separator-regexp))
                            (save-excursion (forward-char -1)
                                            (looking-at (format "[]\"')}]*[ \t]*%s " separator-regexp)))))
              (forward-sexp))
            (if (looking-at separator-regexp)
                (forward-char 1))
            ;; going forward one sexp and back puts point at front of sexp
            ;; essentially skipping the whitespace, but also ensuring we don't
            ;; jump out of a larger closing set of parentheses 
            (forward-sexp)
            (forward-sexp -1))
        (error
         (beep)
         (message "At end of argument list"))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.