in Education by
I am not sure whether this is just a simple mistake of my code. But I just cannot figure out what's the problem is, so please point it out. aaaaa (progn (setq ol-list nil) (dolist (pos '(1 2 3 4)) (let ( (ol (make-overlay pos (1+ pos) (current-buffer))) ) (overlay-put ol 'display "X") (print ol) (setq ol-list (nconc ol-list (list ol))) );; let ) ;; dolist ) (progn (dolist (ol ol-list) (delete-overlay ol)) (setq ol-list nil) ) Put the above code snippet at the beginning your "lisp-mode" buffer, and eval (C-x C-e) each progn section. On my emacs, the first code section will make the "aaaaa" to "Xa". But I think the result should be "XXXXa". So where is the problem? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
See the Emacs Lisp manual, section 38.15.1: For replacing display specifications, “the text that has the property” means all the consecutive characters that have the same Lisp object as their display property; these characters are replaced as a single unit. The manual goes on to explain how to do what you want. You need to allocate a different string for each overlay. Something like this: (overlay-put ol 'display (concat "X")) I also have a couple of suggestions to make your code more Lisp-like: There's no need to put closing parentheses on their own line (see this answer). Emacs shows you matching parentheses, and does automatic indentation, so just leave the closing parentheses where they fall. Your loops will look nicer if you use the loop facility and mapcar respectively. (require 'cl) (setq ol-list (loop for pos from 1 upto 4 collect (let ((ol (make-overlay pos (1+ pos)))) (overlay-put ol 'display (concat "X")) ol))) (mapcar #'delete-overlay ol-list)

Related questions

0 votes
    I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Can we make changes on the repo and how we can make sure that the same has been merged into the working copy?...
asked Feb 18, 2021 in Technology by JackTerrance
0 votes
    The process through which the on-disk tree files periodically merged to create larger consolidated stores is called __________....
asked Jan 26, 2021 in Technology by JackTerrance
0 votes
    How will you identify if the branch is already merged into master?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    I have a list of ggplots of simple ggplot line graphs based on a location. I created a list of ggplot ... (rnaturalearthdata) library(dplyr) library(ggthemes) #create line plot x...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    The background purpose is that I want to divide a country into different regions. For example, divide USA ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    What is Distribution and map overlay in Google Analytics?...
asked Oct 3, 2020 in Technology by JackTerrance
0 votes
0 votes
    Currently I try to switch from vim to emacs and have some difficulty while editing code. For most of ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    When I cut (kill) text in Emacs 22.1.1 (in its own window on X, in KDE, on Kubuntu), ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I am fairly new to Emacs and I have been trying to figure out how to change the default folder ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I've been aware of Steve Yegge's advice to swap Ctrl and Caps Lock for a while now, although I ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    I've been aware of Steve Yegge's advice to swap Ctrl and Caps Lock for a while now, although I ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    I was wondering if there was a way (at least on Ubuntu, which I am using) to have Emacs "always ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
...