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

The Archive Base Latest Questions

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

I would like to imitate the way how most consoles work in a buffer,

  • 0

I would like to imitate the way how most consoles work in a buffer, is there any way to do that? I.e. only allow appending text to the buffer, but not deleting?

Probably I could disable or advise some built-in functions which delete characters, but I’m afraid this isn’t a very scalable solution… I could miss some.

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

    As mentioned, you can set the read-only text-property. Or more simply you can set the buffer-read-only variable and then write a few commands that override it. For example (guaranteed 100% untested code ahead):

    (defun append-only-s-i-c ()
      (let ((inhibit-read-only (eobp)))
        (call-interactively 'self-insert-command)))
    
    (defvar append-only-mode-map
      (let ((map (make-sparse-keymap)))
        (define-key map [remap self-insert-command] 'append-only-s-i-c)
        map))
    
    (define-derived-mode append-only-mode nil "Append-Only"
      "Here's the doc."
      (set (make-local-variable 'buffer-read-only) t))
    

    As demonstrated by this example, the read-only-ness of text can be overriden by a command, so even the read-only text-property won’t guarantee 100% that the text will never be modified, but fairly few commands override the read-only information, so it should not be a serious problem in practice.

    Another approach would be to use before-change-functions and signal an error from there if the modification takes place before EOB. Might be a better approach:

    (defun append-only-b-c-f (beg end)
      (if (< beg (point-max)) (error "Can't modify text: append-only!")))
    
    (define-derived-mode append-only-mode nil "Append-Only"
      "Here's the doc."
      (add-hook 'before-change-functions #'append-only-b-c-f nil 'local))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would like to know if there is any resource on the web that conveniently
Would there be any problems if I did the following to imitate a liked
would like to allow visitors to a web page to upload photos that will
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like to make anapplication in Java that will not automatically parse parameters used
I'm currently writing in C# wpf and I would like to imitate the action
I would like to imitate this exact feature on this page. (Move mouse toward
I would like to imitate the behavior of the default android browser - The
Chrome has a very smooth installation process and I would like to imitate this
Would like to be able to populate any properties of an object and search

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.