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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:11:05+00:00 2026-06-17T12:11:05+00:00

I would like to be able to store text between 2 positions (the string

  • 0

I would like to be able to store text between 2 positions (the string in between), but I don’t know where to conveniently store it, perhaps just locally, or even globally (let or setq). The answer is probably out there, but I couldn’t find it.

Example:

I would like to store text in a symbol in order to search for it backwards. Let’s say the region from (point) until the first whitespace character.

My previous way of doing this was using (kill-ring-save), but I know this is a bad practice.

From (here) (message "hello")(point)

I would be interested in both better techniques for doing this, as well as the best way to store a string which is somehwere around (point).

  • 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-17T12:11:07+00:00Added an answer on June 17, 2026 at 12:11 pm

    If a temporary local scope is all you require, then you definitely want to use let.

    Otherwise you would usually define a variable (keeping in mind when you name it that elisp has no name spaces, so best practice is to use as reliably unique a prefix for all symbol names in a given library as practical).

    (defvar SYMBOL &optional INITVALUE DOCSTRING)
    

    If you omit the INITVALUE argument, the variable will not be bound initially, but ensures that your variable will use dynamic binding once used.

    Then you just setq the variable as required.

    Edit:
    To obtain a buffer’s contents between two points, use either of

    • (buffer-substring START END)
    • (buffer-substring-no-properties START END)

    depending on whether or not you wish to preserve text properties.

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

Sidebar

Related Questions

I would like to be able to store reusable html-formatted text in Sitecore and
I would like to be able to store a list of expressions to execute
I would like to be able to check the text in a text-box after
I'm making a text-based game and I would like my hero to be able
I would like store large amounts of data (text) in a table with six
I would like to compress scanned text (monochrome or few colours) and store it
Would like to be able to set colors of headings and such, different font
I would like to be able to output the name of a variable, along
I would like to be able to print in the logs a message for
I would like to be able to show a personal message to abusers of

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.