* Re: Problem with simple script to clean out an ERC buffer [not found] <mailman.1269.1528233735.1292.help-gnu-emacs@gnu.org> @ 2018-06-06 8:49 ` Emanuel Berg 2018-06-06 12:17 ` J. David Boyd [not found] ` <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-06 8:49 UTC (permalink / raw) To: help-gnu-emacs J. David Boyd wrote: > So I go into an ERC buffer, put the cursor at > the prompt, hit H-C-c, and it always tells me > that "Text is read-only" > > But, if I manually execute the commands > above, and press C-w when I get to the > delete-region command, it works fine. Is it a good idea to manually erase the text/data of an ERC buffer? What's the purpose of that? Perhaps there is an IRC command to do that? -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 8:49 ` Problem with simple script to clean out an ERC buffer Emanuel Berg @ 2018-06-06 12:17 ` J. David Boyd 2018-06-06 12:45 ` Joost Kremers [not found] ` <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 28+ messages in thread From: J. David Boyd @ 2018-06-06 12:17 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > J. David Boyd wrote: > >> So I go into an ERC buffer, put the cursor at >> the prompt, hit H-C-c, and it always tells me >> that "Text is read-only" >> >> But, if I manually execute the commands >> above, and press C-w when I get to the >> delete-region command, it works fine. > > Is it a good idea to manually erase the > text/data of an ERC buffer? > > What's the purpose of that? > > Perhaps there is an IRC command to do that? Yes there is, but it doesn't do anything: erc-cmd-CLEAR Supposed to "Clear the window content", but the code reads: (defun erc-cmd-CLEAR () "Clear the window content." (recenter 0) t) (put 'erc-cmd-CLEAR 'process-not-needed t) So not only does it not clear the window, but it seems to be disabled. Anyway, I like to clear out the buffer so I can reduce my memory footprint. If there is anything important in it, I usually grab it and put it into an org file. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 12:17 ` J. David Boyd @ 2018-06-06 12:45 ` Joost Kremers 2018-06-06 20:34 ` J. David Boyd 0 siblings, 1 reply; 28+ messages in thread From: Joost Kremers @ 2018-06-06 12:45 UTC (permalink / raw) To: J. David Boyd; +Cc: help-gnu-emacs On Wed, Jun 06 2018, J. David Boyd wrote: > Yes there is, but it doesn't do anything: erc-cmd-CLEAR > > Supposed to "Clear the window content", but the code reads: > > (defun erc-cmd-CLEAR () > "Clear the window content." > (recenter 0) > t) > (put 'erc-cmd-CLEAR 'process-not-needed t) > > So not only does it not clear the window, but it seems to be > disabled. No, the erc source mentions that the `process-not-needed' property just indicates that the command can be run when the erc process is not alive. So it's not disabled. Since erc.el is part of Emacs, you might ask on the emacs-devel list why this command doesn't seem to do what it advertises and whether it should be changed to actually "clear the window content". > Anyway, I like to clear out the buffer so I can reduce my memory > footprint. > If there is anything important in it, I usually grab it and put > it into an org > file. As for your original question, your function has a bug: ``` (defun clearERCbuffer() (interactive) (previous-line) (end-of-line) (set-mark(point)) (beginning-of-buffer) (exchange-point-and-mark) ;; (set-text-properties (point-min) (point-max) nil nil ) (delete-region (point-min) (point-max))) ``` The final function call is `(delete-region (point-min) (point-max))`, which means that all the point, mark and region magic you did before that is moot, because you're trying to delete the entire buffer. Which is probably why your getting an error: in the part that you are deleting there's most likely (I don't use erc, so I can't check) something (a prompt perhaps) that is indeed read-only. What you probably want is simply `(delete-region)`, except that START and END aren't optional. So, I would do something like (untested): ``` (defun clearERCbuffer() (interactive) (save-mark-and-excursion (forward-line -1) (end-of-line) (delete-region (point-min) (point)))) ``` Some remarks: - `save-mark-and-excursion` saves point and mark and restores them after executing its body. This means that point should be back to where it was before you called the function. Note that if you're on Emacs 25, you should replace `save-mark-and-excursion` with `save-excursion`. - The doc string of `previous-line` suggests it shouldn't be used in Lisp programs, so I used `(forward-line -1)` instead. - With `delete-region`, there's no need to create an active region first. By (temporarily, due to `save-mark-and-excursion`) positioning the cursor at the end of the previous line, it's possible to simply use (point) as the END argument to `delete-region`. HTH -- Joost Kremers Life has its moments ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 12:45 ` Joost Kremers @ 2018-06-06 20:34 ` J. David Boyd 0 siblings, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-06 20:34 UTC (permalink / raw) To: help-gnu-emacs Joost Kremers <joostkremers@fastmail.fm> writes: > On Wed, Jun 06 2018, J. David Boyd wrote: >> Yes there is, but it doesn't do anything: erc-cmd-CLEAR >> >> Supposed to "Clear the window content", but the code reads: >> >> (defun erc-cmd-CLEAR () >> "Clear the window content." >> (recenter 0) >> t) >> (put 'erc-cmd-CLEAR 'process-not-needed t) >> >> So not only does it not clear the window, but it seems to be >> disabled. > > No, the erc source mentions that the `process-not-needed' property > just indicates that the command can be run when the erc process is not > alive. So it's not disabled. > > Since erc.el is part of Emacs, you might ask on the emacs-devel list > why this command doesn't seem to do what it advertises and whether it > should be changed to actually "clear the window content". > >> Anyway, I like to clear out the buffer so I can reduce my memory >> footprint. >> If there is anything important in it, I usually grab it and put it >> into an org >> file. > > As for your original question, your function has a bug: > > ``` > > (defun clearERCbuffer() > (interactive) > (previous-line) > (end-of-line) > (set-mark(point)) > (beginning-of-buffer) > (exchange-point-and-mark) > ;; (set-text-properties (point-min) (point-max) nil nil ) > (delete-region (point-min) (point-max))) > > ``` > > The final function call is `(delete-region (point-min) (point-max))`, > which means that all the point, mark and region magic you did before > that is moot, because you're trying to delete the entire buffer. > > Which is probably why your getting an error: in the part that you are > deleting there's most likely (I don't use erc, so I can't check) > something (a prompt perhaps) that is indeed read-only. What you > probably want is simply `(delete-region)`, except that START and END > aren't optional. > > So, I would do something like (untested): > > ``` > (defun clearERCbuffer() > (interactive) > (save-mark-and-excursion > (forward-line -1) > (end-of-line) > (delete-region (point-min) (point)))) > ``` > > Some remarks: > > - `save-mark-and-excursion` saves point and mark and restores them > after executing its body. This means that point should be back to > where it was before you called the function. Note that if you're on > Emacs 25, you should replace `save-mark-and-excursion` with > `save-excursion`. > - The doc string of `previous-line` suggests it shouldn't be used in > Lisp programs, so I used `(forward-line -1)` instead. > - With `delete-region`, there's no need to create an active region > first. By (temporarily, due to `save-mark-and-excursion`) positioning > the cursor at the end of the previous line, it's possible to simply > use (point) as the END argument to `delete-region`. > > HTH Thanks. So that's why I kept getting told that I had read-only text. The prompt is indeed read only, so that makes sense. All your ideas make sense, thanks very much! ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org> @ 2018-06-06 12:30 ` Emanuel Berg 2018-06-06 20:35 ` J. David Boyd [not found] ` <mailman.1362.1528317446.1292.help-gnu-emacs@gnu.org> 2018-06-06 17:43 ` Emanuel Berg 1 sibling, 2 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-06 12:30 UTC (permalink / raw) To: help-gnu-emacs J. David Boyd wrote: > Yes there is, but it doesn't do anything: > erc-cmd-CLEAR > > Supposed to "Clear the window content", but the > code reads: > > (defun erc-cmd-CLEAR () "Clear the window > content." (recenter 0) t) (put 'erc-cmd-CLEAR > 'process-not-needed t) Indeed, it doesn't seem to do anything. You can ask at gmane.emacs.erc.general (or erc-discuss@gnu.org) and tell them about it. > Anyway, I like to clear out the buffer so > I can reduce my memory footprint. If there is > anything important in it, I usually grab it > and put it into an org file. "Reduce the memory footprint"??? It is just an Emacs text buffer! -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 12:30 ` Emanuel Berg @ 2018-06-06 20:35 ` J. David Boyd [not found] ` <mailman.1362.1528317446.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-06 20:35 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > J. David Boyd wrote: > >> Yes there is, but it doesn't do anything: >> erc-cmd-CLEAR >> >> Supposed to "Clear the window content", but the >> code reads: >> >> (defun erc-cmd-CLEAR () "Clear the window >> content." (recenter 0) t) (put 'erc-cmd-CLEAR >> 'process-not-needed t) > > Indeed, it doesn't seem to do anything. You can > ask at gmane.emacs.erc.general (or > erc-discuss@gnu.org) and tell them about it. > >> Anyway, I like to clear out the buffer so >> I can reduce my memory footprint. If there is >> anything important in it, I usually grab it >> and put it into an org file. > > "Reduce the memory footprint"??? It is just > an Emacs text buffer! Yes, but I have many many buffers open, lots of ERC buffers open, and just don't like having 30k rows of text that I have already read hanging around.... ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1362.1528317446.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1362.1528317446.1292.help-gnu-emacs@gnu.org> @ 2018-06-07 10:05 ` Emanuel Berg 2018-06-07 14:04 ` J. David Boyd 0 siblings, 1 reply; 28+ messages in thread From: Emanuel Berg @ 2018-06-07 10:05 UTC (permalink / raw) To: help-gnu-emacs J. David Boyd wrote: >> "Reduce the memory footprint"??? It is just >> an Emacs text buffer! > > Yes, but I have many many buffers open, lots > of ERC buffers open, and just don't like > having 30k rows of text that I have already > read hanging around.... Wow, you read a lot of IRC chats! Still, perhaps one can automate this somehow, like once every day, iterate all the ERC buffers, see if they are too long, and if so, clear them. That wouldn't take into consideration what you've read or not so perhaps you still want it manually. -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-07 10:05 ` Emanuel Berg @ 2018-06-07 14:04 ` J. David Boyd 2018-06-07 14:08 ` Van L [not found] ` <mailman.1414.1528380527.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-07 14:04 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > J. David Boyd wrote: > >>> "Reduce the memory footprint"??? It is just >>> an Emacs text buffer! >> >> Yes, but I have many many buffers open, lots >> of ERC buffers open, and just don't like >> having 30k rows of text that I have already >> read hanging around.... > > Wow, you read a lot of IRC chats! > > Still, perhaps one can automate this somehow, > like once every day, iterate all the ERC > buffers, see if they are too long, and if so, > clear them. > > That wouldn't take into consideration what > you've read or not so perhaps you still want > it manually. I definitely want it to be a manual process. Sometimes I don't get back to check a chatroom for a day or more, so I don't want anything truncating it before I get there. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-07 14:04 ` J. David Boyd @ 2018-06-07 14:08 ` Van L [not found] ` <mailman.1414.1528380527.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 28+ messages in thread From: Van L @ 2018-06-07 14:08 UTC (permalink / raw) To: J. David Boyd; +Cc: help-gnu-emacs > J. David Boyd writes: > > Sometimes I don't get back to > check a chatroom for a day or more, so I don't want anything truncating it > before I get there. There is a variable for continuously writing chat buffer to file so you lose nothing. ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1414.1528380527.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1414.1528380527.1292.help-gnu-emacs@gnu.org> @ 2018-06-07 14:19 ` Emanuel Berg 2018-06-07 14:28 ` Van L ` (4 more replies) 0 siblings, 5 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-07 14:19 UTC (permalink / raw) To: help-gnu-emacs Van L wrote: >> Sometimes I don't get back to check >> a chatroom for a day or more, so I don't >> want anything truncating it before >> I get there. > > There is a variable for continuously writing > chat buffer to file so you lose nothing. Hold - Mr. Boyd may run out of disk space doing that! Seriously, what is it in the IRC logs that is so important you have to check it like some 20-ish moronic dude who wants to attend every single party fearing otherwise he will "miss" something? -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-07 14:19 ` Emanuel Berg @ 2018-06-07 14:28 ` Van L [not found] ` <mailman.1415.1528381721.1292.help-gnu-emacs@gnu.org> ` (3 subsequent siblings) 4 siblings, 0 replies; 28+ messages in thread From: Van L @ 2018-06-07 14:28 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs > Emanuel Berg writes: > >>> Sometimes I don't get back to check >>> a chatroom for a day or more, so I don't >>> want anything truncating it before >>> I get there. >> >> There is a variable for continuously writing >> chat buffer to file so you lose nothing. > > Hold - Mr. Boyd may run out of disk space > doing that! True in theory. 30kb file can fit on video file store capacity with plenty to spare in reality. > Seriously, what is it in the IRC logs that is > so important you have to check it like some > 20-ish moronic dude who wants to attend every > single party fearing otherwise he will > "miss" something? Is that what IRC is good for? ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1415.1528381721.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1415.1528381721.1292.help-gnu-emacs@gnu.org> @ 2018-06-07 18:24 ` Emanuel Berg 0 siblings, 0 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-07 18:24 UTC (permalink / raw) To: help-gnu-emacs Van L wrote: >> Seriously, what is it in the IRC logs that >> is so important you have to check it like >> some 20-ish moronic dude who wants to attend >> every single party fearing otherwise he will >> "miss" something? > > Is that what IRC is good for? Now you made me think... IRC is good to not feel alone and completely disconnected from the human race, like to have it output/scroll in the background while not really caring what it says most of the time. IRC is good for the sake of itself, and technology, like the ham/radio amateurs of past decades, calling each other around the globe just to speak about the technology that made it possible and pretty much that's it. IRC is good for very quick questions on technology, questions that you know some guy can answer instantly, questions about problems that will not require/spur any discussion with different options and so on (for such questions, Gmane/Usenet/mailing lists are much better than IRC IMO). -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-07 14:19 ` Emanuel Berg 2018-06-07 14:28 ` Van L [not found] ` <mailman.1415.1528381721.1292.help-gnu-emacs@gnu.org> @ 2018-06-08 5:18 ` Bob Proulx 2018-06-08 7:13 ` Van L [not found] ` <mailman.1460.1528435118.1292.help-gnu-emacs@gnu.org> 2018-06-08 18:12 ` J. David Boyd 4 siblings, 1 reply; 28+ messages in thread From: Bob Proulx @ 2018-06-08 5:18 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg wrote: > Seriously, what is it in the IRC logs that is > so important you have to check it like some > 20-ish moronic dude who wants to attend every > single party fearing otherwise he will > "miss" something? I get a "IRC highlight" if someone addresses my nickname. But I might not be at the keyboard. Here is an example. Alice> Hey Bob can you help me out? A light switch is broken. Can you stop by the house and look at it? And then conversation keeps going with other people. I return to the keyboard some long time later. I see that I have been addressed sometime in the near past. Who was speaking to me? But all I immediately see is a sea of text from other conversation. What I do is I search back for my nickname and see what would have caused me to have been addressed (hightlighted). I find the message from my friend. I respond. Bob> Hi Alice. Sure. I would be happy to come look at your broken light switch. When can I drop by? Now you might say that after a day or two when there was no response because I didn't see it that she should try a different communication method such as email. Timeout and retry. But IRC works for my friend who happens to be a widower and needs a little help like this every so often and it also works for me using the above technique. It wouldn't work if I didn't have enough history to look back to see the message that addressed me. You may think I am a "20-ish moronic dude" but it is just "different strokes for different folks". Bob P.S. The above is a true story summary of a recent exchange that happened in real life. Busted three way hall switch needed to be replaced. I did change the names to the usual placeholder names though. But the events are real. "Ladies and gentlemen: the story you are about to hear is true. Only the names have been changed to protect the innocent." ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-08 5:18 ` Bob Proulx @ 2018-06-08 7:13 ` Van L 0 siblings, 0 replies; 28+ messages in thread From: Van L @ 2018-06-08 7:13 UTC (permalink / raw) To: Bob Proulx; +Cc: help-gnu-emacs > Bob Proulx writes: > > The above is a true story I think once the developers get rx-regexp Pong perfect your search through the history can disappear into a casual conversation with your voice assistant. And, it will remind you in case you forget to ask. ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1460.1528435118.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1460.1528435118.1292.help-gnu-emacs@gnu.org> @ 2018-06-08 10:11 ` Emanuel Berg 2018-06-08 11:59 ` Emanuel Berg 0 siblings, 1 reply; 28+ messages in thread From: Emanuel Berg @ 2018-06-08 10:11 UTC (permalink / raw) To: help-gnu-emacs Bob Proulx wrote: > You may think I am a "20-ish moronic dude" Well, don't think so but yes, I think e-mail or SMS would be much better for this particular use-case :) -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-08 10:11 ` Emanuel Berg @ 2018-06-08 11:59 ` Emanuel Berg 2018-06-10 18:04 ` Bob Proulx [not found] ` <mailman.1633.1528653867.1292.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-08 11:59 UTC (permalink / raw) To: help-gnu-emacs >> You may think I am a "20-ish moronic dude" > > Well, don't think so but yes, I think e-mail or > SMS would be much better for this particular > use-case :) Or, if you insist on IRC, how about setting up a new channel for this purpose? Then you wouldn't have to scroll thru other people's discussion - everything (and nothing else) would already be in that channel. Still, I think e-mail or SMS would be better! I forgot one use case where IRC would be/is great and that is if there is an ongoing project. I suppose the many open source software projects are the best example, but in principle one could think of a bunch of people preparing an expedition to Himalaya or the South Pole having a channel to communicate plans, gear, but also getting to know each other (very important). However this would require everyone to use IRC and I've yet to see a company outside the computer world where everyone used IRC. Remember that if only 2 or 3 people didn't use it the whole idea might even be harmful as some people would expect them to know stuff they didn't, or these 2-3 people would feel excluded. Even in the best of worlds it could be a bad idea since everyone would talk about everything, while actually relaxing subconsciously, "there is so much talk back and forth going on, I'm sure they got it all figured out!" As for the FOSS example, the same thing could happen - not with as disastrous results of course - but rather people would just log in to their favorite software's IRC channels, and they'd think they'd do something useful, but actually just idle or chat about everything else. I think the solution to this particular problem would be to not go for the official #emacs, #tmux, and so so on, but instead create subchannels for their particular field of activity, because most often the channel and even project will be unknown to most users/fans/chatters/idlers. -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-08 11:59 ` Emanuel Berg @ 2018-06-10 18:04 ` Bob Proulx [not found] ` <mailman.1633.1528653867.1292.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 28+ messages in thread From: Bob Proulx @ 2018-06-10 18:04 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg wrote: > >> You may think I am a "20-ish moronic dude" > > > > Well, don't think so but yes, I think e-mail or > > SMS would be much better for this particular > > use-case :) > > Or, if you insist on IRC, how about setting up > a new channel for this purpose? Then you > wouldn't have to scroll thru other people's > discussion - everything (and nothing else) would > already be in that channel. The conversation I shared actually did happen on a dedicated channel already. On IRC anyone can create any number of channels for their own use. So what you said was already happening. If that blows your mind then consider this: There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy. - Hamlet talking to Horatio > Still, I think e-mail or SMS would be better! I often think and wish that other people would do things the way *I* would do them. But, alas, these other people still go off and do things they way *they* want to do them. Usually without consulting me! I can then either compromise and deal with them as best as possible. Or I can crawl further into my hole and push some more rocks on top of the entrance. Bob ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1633.1528653867.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1633.1528653867.1292.help-gnu-emacs@gnu.org> @ 2018-06-10 18:29 ` Emanuel Berg 0 siblings, 0 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-10 18:29 UTC (permalink / raw) To: help-gnu-emacs Bob Proulx wrote: > I often think and wish that other people > would do things the way *I* would do them. I wonder if the downright truth is, that IRC is simply a huge body of technology with no real gain to it save for possibly phycological, or, if there is a gain, this constitutes a very small size compared to the whole of IRC. -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-07 14:19 ` Emanuel Berg ` (3 preceding siblings ...) [not found] ` <mailman.1460.1528435118.1292.help-gnu-emacs@gnu.org> @ 2018-06-08 18:12 ` J. David Boyd 4 siblings, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-08 18:12 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > Van L wrote: > >>> Sometimes I don't get back to check >>> a chatroom for a day or more, so I don't >>> want anything truncating it before >>> I get there. >> >> There is a variable for continuously writing >> chat buffer to file so you lose nothing. > > Hold - Mr. Boyd may run out of disk space > doing that! > > Seriously, what is it in the IRC logs that is > so important you have to check it like some > 20-ish moronic dude who wants to attend every > single party fearing otherwise he will > "miss" something? Nothing, and I don't check it like that. I check it like a 59-ish non-moronic dude is afraid he will "miss" something! :-) ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org> 2018-06-06 12:30 ` Emanuel Berg @ 2018-06-06 17:43 ` Emanuel Berg 2018-06-06 19:12 ` Jonathan Kyle Mitchell ` (3 more replies) 1 sibling, 4 replies; 28+ messages in thread From: Emanuel Berg @ 2018-06-06 17:43 UTC (permalink / raw) To: help-gnu-emacs This reminds me that clear, as in clear(1) or /usr/bin/clear , doesn't do anything in Shell mode either (Shell mode as in shell.el). But hey, aren't programmers trained to see the beauty in symmetry? -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 17:43 ` Emanuel Berg @ 2018-06-06 19:12 ` Jonathan Kyle Mitchell 2018-06-06 19:12 ` Robert Pluim ` (2 subsequent siblings) 3 siblings, 0 replies; 28+ messages in thread From: Jonathan Kyle Mitchell @ 2018-06-06 19:12 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs On Wed, Jun 6, 2018 at 12:43 PM, Emanuel Berg <moasen@zoho.com> wrote: > This reminds me that clear, as in clear(1) or > /usr/bin/clear , doesn't do anything in > Shell mode either (Shell mode as in shell.el). > > But hey, aren't programmers trained to see the > beauty in symmetry? > > -- > underground experts united > http://user.it.uu.se/~embe8573 That's expected since /usr/bin/clear assumes it's talking to a "real" terminal which shell.el is not. On the other hand, eshell.el has its own clear command implemented in Lisp that should work. erc-cmd-CLEAR does something different even though its docstring says it "clears" the window contents. It basically just moves the current line up to the top of the window without erasing the buffer. Whether that's the intention I can't say. -- Jonathan Kyle Mitchell ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 17:43 ` Emanuel Berg 2018-06-06 19:12 ` Jonathan Kyle Mitchell @ 2018-06-06 19:12 ` Robert Pluim [not found] ` <mailman.1348.1528312355.1292.help-gnu-emacs@gnu.org> 2018-06-06 20:45 ` J. David Boyd 3 siblings, 0 replies; 28+ messages in thread From: Robert Pluim @ 2018-06-06 19:12 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > This reminds me that clear, as in clear(1) or > /usr/bin/clear , doesn't do anything in > Shell mode either (Shell mode as in shell.el). > I donʼt think shell mode claims to implement a terminal. Robert ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <mailman.1348.1528312355.1292.help-gnu-emacs@gnu.org>]
* Re: Problem with simple script to clean out an ERC buffer [not found] ` <mailman.1348.1528312355.1292.help-gnu-emacs@gnu.org> @ 2018-06-06 19:23 ` Emanuel Berg 2018-06-06 20:46 ` J. David Boyd 0 siblings, 1 reply; 28+ messages in thread From: Emanuel Berg @ 2018-06-06 19:23 UTC (permalink / raw) To: help-gnu-emacs Robert Pluim wrote: >> This reminds me that clear, as in clear(1) or >> /usr/bin/clear , doesn't do anything in >> Shell mode either (Shell mode as in shell.el). > > I don't think shell mode claims to implement > a terminal. At the moment, it would seem neither does ERC. Nah, I think it is an ordinary bug. If you do the Elisp suggested in this thread (inhibit read-only, then `erase-buffer') you see that not only does it work as one would expect, but hit RET and you get the prompt back, so it doesn't brake anything either. That would indicate it would be a small effort for the ERC people to implement this behavior and associate it with the joint ERC/IRC command that is already there. -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 19:23 ` Emanuel Berg @ 2018-06-06 20:46 ` J. David Boyd 0 siblings, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-06 20:46 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > Robert Pluim wrote: > >>> This reminds me that clear, as in clear(1) or >>> /usr/bin/clear , doesn't do anything in >>> Shell mode either (Shell mode as in shell.el). >> >> I don't think shell mode claims to implement >> a terminal. > > At the moment, it would seem neither does ERC. > > Nah, I think it is an ordinary bug. If you do > the Elisp suggested in this thread (inhibit > read-only, then `erase-buffer') you see that > not only does it work as one would expect, but > hit RET and you get the prompt back, so it > doesn't brake anything either. > > That would indicate it would be a small effort > for the ERC people to implement this behavior > and associate it with the joint ERC/IRC command > that is already there. And that works fine for me. Now I just need to map it to an ERC mode key rather than a global key, and I'm happy. Thanks for all the help, everyone! Dave in Hudson, FL ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 17:43 ` Emanuel Berg ` (2 preceding siblings ...) [not found] ` <mailman.1348.1528312355.1292.help-gnu-emacs@gnu.org> @ 2018-06-06 20:45 ` J. David Boyd 3 siblings, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-06 20:45 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > This reminds me that clear, as in clear(1) or > /usr/bin/clear , doesn't do anything in > Shell mode either (Shell mode as in shell.el). > > But hey, aren't programmers trained to see the > beauty in symmetry? Yeah, a little I guess. But wasn't it Emerson that said the line about "a foolish consistency", and what is symmetry but consistency taken to an extreme? ^ permalink raw reply [flat|nested] 28+ messages in thread
* Problem with simple script to clean out an ERC buffer @ 2018-06-05 21:21 J. David Boyd 2018-06-06 1:18 ` Jonathan Kyle Mitchell 0 siblings, 1 reply; 28+ messages in thread From: J. David Boyd @ 2018-06-05 21:21 UTC (permalink / raw) To: help-gnu-emacs I've put this together: (defun clearERCbuffer() (interactive) (previous-line) (end-of-line) (set-mark(point)) (beginning-of-buffer) (exchange-point-and-mark) ; (set-text-properties (point-min) (point-max) nil nil ) (delete-region (point-min) (point-max))) (bind-key (kbd "H-C-c") 'clearERCbuffer) So I go into an ERC buffer, put the cursor at the prompt, hit H-C-c, and it always tells me that "Text is read-only" But, if I manually execute the commands above, and press C-w when I get to the delete-region command, it works fine. I tried the set-text-properties to remove any read-only attributes, but that makes no difference. What stupidly obvious item am I overlooking? Thanks, Dave in Hudson, FL ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-05 21:21 J. David Boyd @ 2018-06-06 1:18 ` Jonathan Kyle Mitchell 2018-06-06 12:29 ` J. David Boyd 0 siblings, 1 reply; 28+ messages in thread From: Jonathan Kyle Mitchell @ 2018-06-06 1:18 UTC (permalink / raw) To: J. David Boyd; +Cc: help-gnu-emacs On Tue, Jun 5, 2018 at 4:21 PM, J. David Boyd <dboyd2@mmm.com> wrote: > > > I've put this together: > > > (defun clearERCbuffer() > (interactive) > (previous-line) > (end-of-line) > (set-mark(point)) > (beginning-of-buffer) > (exchange-point-and-mark) > ; (set-text-properties (point-min) (point-max) nil nil ) > (delete-region (point-min) (point-max))) > > (bind-key (kbd "H-C-c") 'clearERCbuffer) > > > So I go into an ERC buffer, put the cursor at the prompt, hit H-C-c, and it > always tells me that "Text is read-only" > > But, if I manually execute the commands above, and press C-w when I get to the > delete-region command, it works fine. > > I tried the set-text-properties to remove any read-only attributes, but that > makes no difference. > > What stupidly obvious item am I overlooking? > > Thanks, > > Dave in Hudson, FL How about just: (let ((inhibit-read-only t)) (erase-buffer)) [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-Only-Buffers.html -- Jonathan Kyle Mitchell ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Problem with simple script to clean out an ERC buffer 2018-06-06 1:18 ` Jonathan Kyle Mitchell @ 2018-06-06 12:29 ` J. David Boyd 0 siblings, 0 replies; 28+ messages in thread From: J. David Boyd @ 2018-06-06 12:29 UTC (permalink / raw) To: help-gnu-emacs Jonathan Kyle Mitchell <kyle@jonathanmitchell.org> writes: > On Tue, Jun 5, 2018 at 4:21 PM, J. David Boyd <dboyd2@mmm.com> wrote: >> >> >> I've put this together: >> >> >> (defun clearERCbuffer() >> (interactive) >> (previous-line) >> (end-of-line) >> (set-mark(point)) >> (beginning-of-buffer) >> (exchange-point-and-mark) >> ; (set-text-properties (point-min) (point-max) nil nil ) >> (delete-region (point-min) (point-max))) >> >> (bind-key (kbd "H-C-c") 'clearERCbuffer) >> >> >> So I go into an ERC buffer, put the cursor at the prompt, hit H-C-c, and it >> always tells me that "Text is read-only" >> >> But, if I manually execute the commands above, and press C-w when I get to the >> delete-region command, it works fine. >> >> I tried the set-text-properties to remove any read-only attributes, but that >> makes no difference. >> >> What stupidly obvious item am I overlooking? >> >> Thanks, >> >> Dave in Hudson, FL > > > How about just: > > (let ((inhibit-read-only t)) > (erase-buffer)) > > [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-Only-Buffers.html > > -- > Jonathan Kyle Mitchell Thanks, that did the trick. Always grateful the help that is available here! Dave in Hudson, FL ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2018-06-10 18:29 UTC | newest] Thread overview: 28+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.1269.1528233735.1292.help-gnu-emacs@gnu.org> 2018-06-06 8:49 ` Problem with simple script to clean out an ERC buffer Emanuel Berg 2018-06-06 12:17 ` J. David Boyd 2018-06-06 12:45 ` Joost Kremers 2018-06-06 20:34 ` J. David Boyd [not found] ` <mailman.1324.1528287460.1292.help-gnu-emacs@gnu.org> 2018-06-06 12:30 ` Emanuel Berg 2018-06-06 20:35 ` J. David Boyd [not found] ` <mailman.1362.1528317446.1292.help-gnu-emacs@gnu.org> 2018-06-07 10:05 ` Emanuel Berg 2018-06-07 14:04 ` J. David Boyd 2018-06-07 14:08 ` Van L [not found] ` <mailman.1414.1528380527.1292.help-gnu-emacs@gnu.org> 2018-06-07 14:19 ` Emanuel Berg 2018-06-07 14:28 ` Van L [not found] ` <mailman.1415.1528381721.1292.help-gnu-emacs@gnu.org> 2018-06-07 18:24 ` Emanuel Berg 2018-06-08 5:18 ` Bob Proulx 2018-06-08 7:13 ` Van L [not found] ` <mailman.1460.1528435118.1292.help-gnu-emacs@gnu.org> 2018-06-08 10:11 ` Emanuel Berg 2018-06-08 11:59 ` Emanuel Berg 2018-06-10 18:04 ` Bob Proulx [not found] ` <mailman.1633.1528653867.1292.help-gnu-emacs@gnu.org> 2018-06-10 18:29 ` Emanuel Berg 2018-06-08 18:12 ` J. David Boyd 2018-06-06 17:43 ` Emanuel Berg 2018-06-06 19:12 ` Jonathan Kyle Mitchell 2018-06-06 19:12 ` Robert Pluim [not found] ` <mailman.1348.1528312355.1292.help-gnu-emacs@gnu.org> 2018-06-06 19:23 ` Emanuel Berg 2018-06-06 20:46 ` J. David Boyd 2018-06-06 20:45 ` J. David Boyd 2018-06-05 21:21 J. David Boyd 2018-06-06 1:18 ` Jonathan Kyle Mitchell 2018-06-06 12:29 ` J. David Boyd
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).