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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:21:47+00:00 2026-05-13T15:21:47+00:00

What is a good way to evaluate the (+ 100 (+ 100 100)) part

  • 0

What is a good way to evaluate the (+ 100 (+ 100 100)) part in

(+ (+ 1 2) (+ 100 (+ 100 100)))

?

For now, I do it by C-x C-e, which means I need to locate the ending parenthesis, which is difficult in most cases. Options > Paren Matching Highlighting helps, but still I need to move the cursor toward the ending parenthesis until the highlighted match is the starting parenthesis.

One way would be to have the reverse version of C-x C-e, so that I can place the cursor at the starting parenthesis like this:

(+ (+ 1 2) |(+ 100 (+ 100 100)))

and then press the appropriate keybinding.

Or I could place the cursor inside the expression, but not inside smaller expressions,:

(+ (+ 1 2) (+ | 100 (+ 100 100)))

and press a keybinding. Because aiming at a target is easier if the target is big.

How can I make such a command? Or is there one already provided?

Sidenote: bar cursor and box cursor

Emacsers who use box cursor (default) might wonder where I’m putting the cursor with the bar notation above. In emacs, you can choose box cursor or bar cursor, (bar-cursor-mode t). When the bar cursor is between the letters A and B, the box cursor is on B. So the bar is the left wall of the box.

BTW, the concept of bar cursor is useful in some unusual way:
The practice of iterating from index1 to index2-1 in programming surprises beginners. It helps to imagine index1 and index2 as indicating bars (left walls) rather than boxes.

  • 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-13T15:21:47+00:00Added an answer on May 13, 2026 at 3:21 pm

    Bind a key to one or both of these:

    (defun eval-next-sexp ()
      (interactive)
      (save-excursion
        (forward-sexp)
        (eval-last-sexp nil)))
    
    (defun eval-surrounding-sexp (levels)
      (interactive "p")
      (save-excursion
        (up-list (abs levels))
        (eval-last-sexp nil)))
    

    Tangentially related, I highly recommend paredit for working with s-expressions. The structure editing commands and bindings make editing s-expressions a breeze. It binds C-down to up-list, so that eval-surrounding-sexp above is almost exactly the same as C-down C-x C-e (the only difference is that the function uses save-excursion to prevent movement).

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

Sidebar

Related Questions

What is a good way to get a reference to singleton objects in Objective-C?
I'd like to know a good way to generate several megabytes of random data
How would you evaluate project size? Part A: Before you start a project. Part
The purpose of this quetion is to evaluate the reasonability of using Drools for
I'm planning software that's an OLAP application at its heart (it helps analyse metering
Can anybody recommend a pattern for unit-testing code within a Mathematica notebook ? I
Let's say that I create a Sub (not a function) whose mission in life
I'm playing around with some onset/beat detection algorithms on my own. My input is
We know that compilers are getting better and better at optimising our code and

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.