* Replacing huge hidden selection when pasting text @ 2015-12-24 1:01 Alexandre Oberlin 2015-12-24 1:37 ` Drew Adams ` (3 more replies) 0 siblings, 4 replies; 40+ messages in thread From: Alexandre Oberlin @ 2015-12-24 1:01 UTC (permalink / raw) To: help-gnu-emacs I have stopped hoping that the current maintainers of Emacs still have an ounce of common sense. How on Earth can it be possible (and quite easy) to allow replacing a huge hidden selection when pasting text without any warning ? I have lost large amounts of data with this incredibly stupid behavior. There isn't even a warning when saving a file which has shrunk a lot, like there once was. How can I DEFINITELY avoid overwriting an invisible selection in all versions of Emacs? ^ permalink raw reply [flat|nested] 40+ messages in thread
* RE: Replacing huge hidden selection when pasting text 2015-12-24 1:01 Replacing huge hidden selection when pasting text Alexandre Oberlin @ 2015-12-24 1:37 ` Drew Adams 2015-12-24 13:27 ` Alexandre Oberlin 2015-12-24 5:48 ` Pascal J. Bourguignon ` (2 subsequent siblings) 3 siblings, 1 reply; 40+ messages in thread From: Drew Adams @ 2015-12-24 1:37 UTC (permalink / raw) To: Alexandre Oberlin, help-gnu-emacs > I have stopped hoping that the current maintainers of Emacs still have an > ounce of common sense. How on Earth can it be possible (and quite easy) to > allow replacing a huge hidden selection when pasting text without any > warning ? I have lost large amounts of data with this incredibly stupid > behavior. There isn't even a warning when saving a file which has shrunk a > lot, like there once was. How can I DEFINITELY avoid overwriting an > invisible selection in all versions of Emacs? I can tell you are upset, and I would be too, no doubt. But if you can describe what you did in more detail it would help. At the very least it might help others avoid the same gotcha that apparently bit you. This is a user help list, and most people reading it and contributing to it are users, like you. If you can provide a step-by-step recipe to describe what you did and what happened, that can also serve as a bug report or enhancement request, which you can post using `M-x report-emacs-bug'. HTH. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 1:37 ` Drew Adams @ 2015-12-24 13:27 ` Alexandre Oberlin 2015-12-24 23:04 ` Stefan Monnier ` (3 more replies) 0 siblings, 4 replies; 40+ messages in thread From: Alexandre Oberlin @ 2015-12-24 13:27 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs Hello, Thanks Drew for your understanding. I don’t think I lost much data this time because I automatically perform the awfully outdated rcs (hopefully nobody tries to "maintain" rcs to make it behave like a Microsoft application!) and also have some backup strategy. This time I simply lost about two hours, but I am still under this threat and might have other files corrupted without having noticed. > But if you can describe what you did in more detail it would help. No problem: C-y C-x C-s No prompt, no auto-saved copy, no warning whatsoever: farewell! What is still worse is that this does not even happen consistently (only say 50% of the times). The behavior is affected by repeatedly setting the mark (C-space). Just reading the help for such a simple command as (set-mark-command ARG) is a mere piece of fun. Don’t Emacs developers/maintainers understand that an editor is to be USED by USERS, not constantly modified and absurdly complicated by people trying to show up their skills? I use GNU Emacs in several contexts: 1. Standard Debian 8 installation 2. Ubuntu 14.04 LTS Live with persistence 3. Cygwin on Windows 7 and Windows 8.1 I use the same .emacs for all contexts. For several years now I’ve not been able to get a safe, stable and sufficiently convenient behavior anymore, especially relative to clipboard and accented characters. On 24 December 2015 at 02:37, Drew Adams <drew.adams@oracle.com> wrote: > > I have stopped hoping that the current maintainers of Emacs still have an > > ounce of common sense. How on Earth can it be possible (and quite easy) > to > > allow replacing a huge hidden selection when pasting text without any > > warning ? I have lost large amounts of data with this incredibly stupid > > behavior. There isn't even a warning when saving a file which has shrunk > a > > lot, like there once was. How can I DEFINITELY avoid overwriting an > > invisible selection in all versions of Emacs? > > I can tell you are upset, and I would be too, no doubt. But if you > can describe what you did in more detail it would help. > > At the very least it might help others avoid the same gotcha that > apparently bit you. This is a user help list, and most people > reading it and contributing to it are users, like you. > > If you can provide a step-by-step recipe to describe what you did > and what happened, that can also serve as a bug report or enhancement > request, which you can post using `M-x report-emacs-bug'. > > HTH. > ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 13:27 ` Alexandre Oberlin @ 2015-12-24 23:04 ` Stefan Monnier 2015-12-25 1:18 ` Pascal J. Bourguignon ` (2 subsequent siblings) 3 siblings, 0 replies; 40+ messages in thread From: Stefan Monnier @ 2015-12-24 23:04 UTC (permalink / raw) To: help-gnu-emacs >> But if you can describe what you did in more detail it would help. > No problem: > C-y > C-x C-s > No prompt, no auto-saved copy, no warning whatsoever: farewell! The way you start Emacs will determine what C-y does, so your recipe is hopelessly incomplete. Stefan ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 13:27 ` Alexandre Oberlin 2015-12-24 23:04 ` Stefan Monnier @ 2015-12-25 1:18 ` Pascal J. Bourguignon [not found] ` <mailman.529.1451006347.843.help-gnu-emacs@gnu.org> [not found] ` <mailman.528.1450998293.843.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 40+ messages in thread From: Pascal J. Bourguignon @ 2015-12-25 1:18 UTC (permalink / raw) To: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > Hello, > > Thanks Drew for your understanding. I don’t think I lost much data this > time because I automatically perform the awfully outdated rcs (hopefully > nobody tries to "maintain" rcs to make it behave like a Microsoft > application!) and also have some backup strategy. This time I simply lost > about two hours, but I am still under this threat and might have other > files corrupted without having noticed. > >> But if you can describe what you did in more detail it would help. > No problem: > C-y > C-x C-s > No prompt, no auto-saved copy, no warning whatsoever: farewell! For example, try it with: emacs -q As I wrote, by default emacs binds C-y to yank: it doesn't even have a delete-region-and-yank, you have to program it yourself (or one of the third-party modes you're using). > What is still worse is that this does not even happen consistently (only > say 50% of the times). The behavior is affected by repeatedly setting the > mark (C-space). Again, this is clearly explained by customizations you've done, not by the behavior of emacs which is perfectly safe. You can test it yourself: - type something - C-@ C-a - M-x yank RET and see how the kill buffer is INSERTED without replacing the text in the region. > Just reading the help for such a simple command as > (set-mark-command ARG) is a mere piece of fun. Don’t Emacs > developers/maintainers understand that an editor is to be USED by USERS, > not constantly modified and absurdly complicated by people trying to show > up their skills? But try to put yourself in the shoes of programmers who want to be able to modify their program to their taste and needs! We need to have programming documentation of each function in that software to be able to use them in your modifications and additions! In any case, you don't get a say about it: we're the programmers. If you're not happy with that, you can always write your own software. (Or pay Microsoft to do that, and pray they won't use it to spy you). Oh, I seem to see what's your problem with the documentation of set-mark-command; this sentence: … this is the closest equivalent in Emacs to what some editors call the "selection". It should have been: … the closest equivalent in what word processors implemented ten or twenty years after emacs was developed, would be the "selection". Perhaps you should read the emacs user manual instead of the programmer's documentation; if it's correctly installed, you may access it by typing C-x C-e after each expressions here: (info "(emacs) Mark") (info "(emacs) Killing") Notably in the Killing section, you have two different subsections for: (info "(emacs) Deletion and Killing") (info "(emacs) Yanking") emacs doesn't delete anything when it yanks. Unless again, you've explicitely asked it by programming the delete-region-and-yank command I shown you earlier, or you are using a 3rd-party mode or library than installs it for you. You can verify what command will be executed by your key typing: C-h k <key> C-h k C-y should give you the help page for yank: "yank is an interactive compiled Lisp function in `simple.el'. …" You should take note of the mode the buffer's in when you don't have C-y bound to yank, and then you can complain about that mode, but not about emacs. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.529.1451006347.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.529.1451006347.843.help-gnu-emacs@gnu.org> @ 2016-01-02 21:40 ` Alexandre Oberlin 2016-01-02 22:03 ` Marcin Borkowski [not found] ` <mailman.1550.1451772215.843.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-02 21:40 UTC (permalink / raw) To: help-gnu-emacs Hello Pascal, Thanks for your reply. On Friday, December 25, 2015 at 2:19:10 AM UTC+1, Pascal J. Bourguignon wrote: > Again, this is clearly explained by customizations you've done, not by > the behavior of emacs which is perfectly safe. You can test it > yourself: I guess that by "the behavior of emacs" you mean "the behavior of emacs -q" [...] > But try to put yourself in the shoes of programmers who want to be able > to modify their program to their taste and needs! We need to have > programming documentation of each function in that software to be able > to use them in your modifications and additions! Having an exhaustive documentation of each function is great. Inconsiderately overloading basic user functions not that much. BTW aren't your 2 quoted sentences above a bit contradictory to each other? There is absolutely nothing special in the configuration I currently use. I just had to disable transient-mode because highlighting almost the whole buffer during isearch as well as extending (and highlighting) the region without pressing SHIFT is not my cup of tea. BTW I read this funny thing in the set-mark-command help: > When Transient Mark Mode is off, immediately repeating this > command activates `transient-mark-mode' temporarily. That is actually the only recipe I found to avoid the fatal overwriting! > In any case, you don't get a say about it: we're the programmers. http://migo.info/images/index.jpeg Cheers, ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-02 21:40 ` Alexandre Oberlin @ 2016-01-02 22:03 ` Marcin Borkowski [not found] ` <mailman.1550.1451772215.843.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 40+ messages in thread From: Marcin Borkowski @ 2016-01-02 22:03 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: help-gnu-emacs Hi all, On 2016-01-02, at 22:40, Alexandre Oberlin <alxobr@gmail.com> wrote: > Hello Pascal, > > Thanks for your reply. > > On Friday, December 25, 2015 at 2:19:10 AM UTC+1, Pascal J. Bourguignon wrote: >> Again, this is clearly explained by customizations you've done, not by >> the behavior of emacs which is perfectly safe. You can test it >> yourself: > I guess that by "the behavior of emacs" you mean "the behavior of emacs -q" That's obvious. But (from my experience with Emacs) also "the behavior of Emacs with (at least one) reasonable configuration". > [...] > >> But try to put yourself in the shoes of programmers who want to be able >> to modify their program to their taste and needs! We need to have >> programming documentation of each function in that software to be able >> to use them in your modifications and additions! > Having an exhaustive documentation of each function is great. Inconsiderately overloading basic user functions not that much. Out of curiosity: what exactly do you mean by "overloading basic user functions"? > There is absolutely nothing special in the configuration I currently use. I just had to disable transient-mode because highlighting almost the whole buffer during isearch as well as extending (and highlighting) the region without pressing SHIFT is not my cup of tea. Highlighting during isearch? It's not what Emacs does for me, and I have transient-mark-mode on all the time. > Cheers, Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1550.1451772215.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1550.1451772215.843.help-gnu-emacs@gnu.org> @ 2016-01-02 22:28 ` Alexandre Oberlin 2016-01-02 23:04 ` Drew Adams [not found] ` <mailman.1551.1451775915.843.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-02 22:28 UTC (permalink / raw) To: help-gnu-emacs Hi Marcin, Thanks for your reply. I double checked .emacs and site-start.el and the only relevant lines I was able to find appear in my .emacs in that order: (delete-selection-mode 1) (transient-mark-mode -1) (cua-mode -1) Now if the behavior was stable I would have got rid of it long ago by any means, since I noticed it several times and already long ago. However it is NOT stable, but when it has happened once it consistently happens in the current session. So clearly it's a bug. ^ permalink raw reply [flat|nested] 40+ messages in thread
* RE: Replacing huge hidden selection when pasting text 2016-01-02 22:28 ` Alexandre Oberlin @ 2016-01-02 23:04 ` Drew Adams [not found] ` <mailman.1551.1451775915.843.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 40+ messages in thread From: Drew Adams @ 2016-01-02 23:04 UTC (permalink / raw) To: Alexandre Oberlin, help-gnu-emacs > I double checked .emacs and site-start.el and the only relevant lines I was > able to find appear in my .emacs in that order: > (delete-selection-mode 1) > (transient-mark-mode -1) > (cua-mode -1) Apologies for not following this thread. But offhand I'd say that there's your problem right there: you enable `delete-selection-mode' but you disable `transient-mark-mode'. That should be a no-no. See `C-h f delete-selection-mode': When Delete Selection mode is enabled, Transient Mark mode is also enabled, typed text replaces the selection if the selection is active, and DEL deletes the selection. Otherwise, typed text is just inserted at point, as usual. d-s-mode ENABLES t-m-mode, on purpose. ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1551.1451775915.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1551.1451775915.843.help-gnu-emacs@gnu.org> @ 2016-01-03 0:11 ` Alexandre Oberlin 2016-01-03 0:28 ` Michael Heerdegen ` (6 more replies) 0 siblings, 7 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-03 0:11 UTC (permalink / raw) To: help-gnu-emacs On Sunday, January 3, 2016 at 12:05:17 AM UTC+1, Drew Adams wrote: > Apologies for not following this thread. But offhand I'd say that > there's your problem right there: you enable `delete-selection-mode' > but you disable `transient-mark-mode'. That should be a no-no. Oh my dear, I managed to hit a no-no! But if it's a no-no why is it possible in the first place? Why ain't there a single warning? Where are emacs's no-nos listed? Where is the checkbox and message saying "I agree not to do any emacs no-no, even if I don't know what they are"? Are you serious? You can't ask all Emacs users to be expert in its ever changing configuration rules. Don't you think they might have some other work to do? Enabling delete-selection-mode and disabling transient-mark-mode is nothing more than what an average user unsatisfied with the default behavior would try at first in order to get a "Windows notepad" like behavior regarding selection and overwriting. This is not rocket science is it? However, I must repeat that the problem is not really here, since the program often functions correctly with the above settings. All I can conclude by now is that all users of Emacs today must be aware of an unpublished list of no-nos which allow the program to function erratically. I am sure you will gain loads of Windows users with that kind of philosophy. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 0:11 ` Alexandre Oberlin @ 2016-01-03 0:28 ` Michael Heerdegen [not found] ` <mailman.1554.1451780942.843.help-gnu-emacs@gnu.org> ` (5 subsequent siblings) 6 siblings, 0 replies; 40+ messages in thread From: Michael Heerdegen @ 2016-01-03 0:28 UTC (permalink / raw) To: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > However, I must repeat that the problem is not really here, since the > program often functions correctly with the above settings. All I can > conclude by now is that all users of Emacs today must be aware of an > unpublished list of no-nos which allow the program to function > erratically. No, they must just read the docs before using something. As the thing has more features and is more complicated than other tools, there is also more documentation. > I am sure you will gain loads of Windows users with that kind of > philosophy. Nobody is forced to use Emacs. If you dislike it's philosophy, use something different you like more. Many people like Emacs because of its philosophy. Michael. ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1554.1451780942.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1554.1451780942.843.help-gnu-emacs@gnu.org> @ 2016-01-03 0:41 ` Alexandre Oberlin 2016-01-03 1:07 ` Michael Heerdegen 2016-01-03 2:10 ` Robert Thorpe 0 siblings, 2 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-03 0:41 UTC (permalink / raw) To: help-gnu-emacs On Sunday, January 3, 2016 at 1:29:04 AM UTC+1, Michael Heerdegen wrote: > Nobody is forced to use Emacs. If you dislike it's philosophy, use > something different you like more. Many people like Emacs because of > its philosophy. I like emacs philosophy and have used it for ages. What I am far from liking as much is the philosophy of its current maintainers. How about starting up their own editor and leave emacs alone? ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 0:41 ` Alexandre Oberlin @ 2016-01-03 1:07 ` Michael Heerdegen 2016-01-03 2:10 ` Robert Thorpe 1 sibling, 0 replies; 40+ messages in thread From: Michael Heerdegen @ 2016-01-03 1:07 UTC (permalink / raw) To: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > I like emacs philosophy and have used it for ages. What I am far from > liking as much is the philosophy of its current maintainers. How about > starting up their own editor and leave emacs alone? Has Emacs been more stringent in the older days? I can't estimate. I think most people only use a subset of the features/commands (or even of the meanings of the prefix arg). Anybody can pick what he thinks fits his working style. Dunno if that's optimal. I don't think Emacs has changed to the worse in the last years. Of course, breakage of working configurations, or a changed behavior with a constant configuration, is always annoying. Some changes led to confusion (e.g. advice.el -> nadvice.el, or the changes in the copy and yank behavior). But under the line, I liked every new version of Emacs more than the version before. Regards, Michael. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 0:41 ` Alexandre Oberlin 2016-01-03 1:07 ` Michael Heerdegen @ 2016-01-03 2:10 ` Robert Thorpe 1 sibling, 0 replies; 40+ messages in thread From: Robert Thorpe @ 2016-01-03 2:10 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > On Sunday, January 3, 2016 at 1:29:04 AM UTC+1, Michael Heerdegen wrote: >> Nobody is forced to use Emacs. If you dislike it's philosophy, use >> something different you like more. Many people like Emacs because of >> its philosophy. > I like emacs philosophy and have used it for ages. What I am far from > liking as much is the philosophy of its current maintainers. How about > starting up their own editor and leave emacs alone? I suggested that delete-selection-mode could be the problem when you first posted your question. For minor-modes Emacs has behaved like this for a long time. You have to read the documention. For example, global-font-lock mode is not obeyed by Info buffers. That's not immediately obvious, but it's been like that for as long as I've used Emacs (since 20.3 in ~2000). Emacs allows you to activate minor-modes that may not make sense with the current major-mode or other minor-modes. I think others haven't had your problem because your setup is uncommon. You want the region to work in the classic Emacs manner where it's not visibly shown on-screen and it always exists. But, you want delete to work as it does in today's MS Windows programs where it deletes the selection. Most people want either old-Emacs behaviour or Windows behaviour. Myself, I use transient-mark-mode but not delete-selection-mode. The documentation could be clearer though and a warning could be issued. Perhaps send a bug report asking for a warning. BR, Robert Thorpe ^ permalink raw reply [flat|nested] 40+ messages in thread
* RE: Replacing huge hidden selection when pasting text 2016-01-03 0:11 ` Alexandre Oberlin 2016-01-03 0:28 ` Michael Heerdegen [not found] ` <mailman.1554.1451780942.843.help-gnu-emacs@gnu.org> @ 2016-01-03 2:11 ` Drew Adams 2016-01-03 2:25 ` Michael Heerdegen ` (3 subsequent siblings) 6 siblings, 0 replies; 40+ messages in thread From: Drew Adams @ 2016-01-03 2:11 UTC (permalink / raw) To: Alexandre Oberlin, help-gnu-emacs > > Apologies for not following this thread. But offhand I'd say that > > there's your problem right there: you enable `delete-selection-mode' > > but you disable `transient-mark-mode'. That should be a no-no. Apparently I should not have been so cavalier with that last sentence, which I meant somewhat tongue-in-cheek, but instead I should have said something like this: You might not want to do that. > Oh my dear, I managed to hit a no-no! But if it's a no-no why is it possible > in the first place? Why ain't there a single warning? Where are emacs's no- > nos listed? Where is the checkbox and message saying "I agree not to do any > emacs no-no, even if I don't know what they are"? Are you serious? > > You can't ask all Emacs users to be expert in its ever changing > configuration rules. Don't you think they might have some other work to do? > Enabling delete-selection-mode and disabling transient-mark-mode is nothing > more than what an average user unsatisfied with the default behavior would > try at first in order to get a "Windows notepad" like behavior regarding > selection and overwriting. This is not rocket science is it? > > However, I must repeat that the problem is not really here, since the > program often functions correctly with the above settings. All I can > conclude by now is that all users of Emacs today must be aware of an > unpublished list of no-nos which allow the program to function erratically. > > I am sure you will gain loads of Windows users with that kind of philosophy. Sheesh. Guess I should have stayed out of the thread. I thought to help, but apparently the info I provided just aggravated you. "No-no" was kidding on my part. I meant to suggest that `delete-selection-mode' was designed from the outset to use `transient-mark-mode', and that if you turn the latter off then you might find that the result is, well, behavior that you didn't expect. Maybe. Why is it possible to, so to speak, shoot yourself in the foot this way? Emacs has no special tamper-proof covering, and it comes with no guarantees. Part of the aim of Emacs is to be open. And that includes open to experimentation and using its code any way you like. Emacs even opens its innards to ordinary end users who might want to peer in. Emacs typically tells you what it does and how it works, especially if you know how to ask it. And it does try to prevent typical use from accidentally deleting data. And in some cases that means, yes, warning users. (BTW, I don't think this is true: "There isn't even a warning when saving a file which has shrunk a lot, like there once was." I've seen such warnings in recent Emacs versions. If you can reproduce this problem, please consider filing a bug report: `M-x report-emacs-bug'. At least to me, that sounds like it would be a bug.) If you want to turn d-s-mode on and t-m-mode off then you can certainly do that. Go for it. The doc string tells you that d-s-mode turns t-m-mode on, but it does not say you can't turn it off. Some users might even prefer whatever behavior that results in. Dunno. And if you do not then you are free to change the resulting behavior to whatever you like. The source code is there for you to play with, or you can just code up your own toy from scratch. No problem. Emacs invites, and even encourages, fiddling, by all of its users, at whatever level of interest or expertise. And perhaps the d-s-mode doc should explicitly say that it turns t-m-mode on BECAUSE that way you can see what will it will delete. And perhaps it should explicitly say that you probably do not want to turn t-m-mode off when d-s-mode is on. Dunno. You seem to think it should, so maybe consider suggesting such a doc change: `M-x report-emacs-bug'. > You can't ask all Emacs users to be expert in its ever changing > configuration rules. If you mean by that that it is not too polite for Emacs to change the rules often and without explanation, then I certainly agree that that should be a no-no. (Oops, there I go again.) Emacs sometimes changes more than I, as one user, want, or in ways that I am not crazy about. But overall, Emacs change has been pretty conservative. And I, for one, happen to agree with a conservative approach to changing Emacs configuration. Changes in Emacs behavior, especially changes in default behavior, are always documented (or should always be) in the "NEWS" that is available with each Emacs release. You can consult the NEWS using `C-h N'. If you don't do it first thing when you change to a new Emacs version then you might at least want to do it when you think you notice a change in default behavior. (Just a suggestion - not a no-no not to do so.) I will just mention, wrt changes in d-s-mode and t-m-mode: 1. Both d-s-mode and t-m-mode have been around for a _very_ long time. 2. They both remain essentially as they were from the outset. 3. But there have been some changes, specifically (a) turning on t-m-mode (but not d-s-mode) by default and (b) the introduction of a "temporary t-m-mode", in particular for those who prefer to turn t-m-mode off. (FWIW, I use d-s-mode, and I've argued for years that it be turned on by default.) 4. Even the change to turn on t-m-mode by default was the result of long discussions by lots of people (and open to anyone) over many years. Lots of reasoned arguments were debated. This is to say that, at least in this case, change in the default Emacs behavior ("configuration change") was not discussed by only a few or decided precipitously or carelessly. The founder of Emacs was the ultimate decider for this change, and he was a participant in the discussion. He also has the user-oriented reflex to remind those who are now deciding Emacs stuff to please consider polling the users before making important "configuration" changes. (And I, for one, am glad that he does.) If you want "to get a 'Windows notepad' like behavior regarding selection and overwriting", then I think just turning on d-s-mode comes pretty close. Nothing that I know of comes closer out of the box. And know, in case you are interested, that you can customize the d-s-m behavior for any particular commands by putting a particular value of property `delete-selection' on their symbols. For example, if you have your own command `yank-it' that yanks something, and you want d-s-mode to understand that your command is a yank so that it lets you yank whatever is already copied (to the kill-ring) rather than just yanking the very region that is currently selected, then you would do this: (put 'yank-it 'delete-selection 'yank) Here's a suggestion, if you think that something useful for users could be added to the d-s-mode or the t-m-mode doc: Suggest a doc improvement as an enhancement request. It's easy to do that: `M-x report-emacs-bug'. HTH. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 0:11 ` Alexandre Oberlin ` (2 preceding siblings ...) 2016-01-03 2:11 ` Drew Adams @ 2016-01-03 2:25 ` Michael Heerdegen 2016-01-03 3:10 ` Drew Adams 2016-01-03 4:09 ` Yuri Khan ` (2 subsequent siblings) 6 siblings, 1 reply; 40+ messages in thread From: Michael Heerdegen @ 2016-01-03 2:25 UTC (permalink / raw) To: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > On Sunday, January 3, 2016 at 12:05:17 AM UTC+1, Drew Adams wrote: > > > Apologies for not following this thread. But offhand I'd say that > > there's your problem right there: you enable `delete-selection-mode' > > but you disable `transient-mark-mode'. That should be a no-no. > Oh my dear, I managed to hit a no-no! But if it's a no-no why is it > possible in the first place? Why ain't there a single warning? Where > are emacs's no-nos listed? Where is the checkbox and message saying "I > agree not to do any emacs no-no, even if I don't know what they are"? > Are you serious? I think there was much confusion in the thread, no doubt did the nihilistic tone of Alexandre inhibit a fruitful discussion. Drew only wanted to help. But I think he was wrong with what he said. I think it's ok to use the two modes at the same time. In the sentence Drew cited: When Delete Selection mode is enabled, Transient Mark mode is also ^^ enabled, typed text replaces the selection if the selection is active, and DEL deletes the selection. I think there is an "and" missing, and the sentence means something different from what we thought. The current docstring (in my Emacs 25) says: When Delete Selection mode is enabled, typed text replaces the selection if the selection is active. Otherwise, typed text is just inserted at point regardless of any selection. With `transient-mark-mode' off, you can mark a region (i.e., turn on transient mark mode temporarily) by hitting C-SPC twice. Only then does delete-selection-mode replace the region. In any other case (when the region is not visible, i.e. not active) transient-mark-mode is just off, and delete-selection-mode should not delete the region, never. So I think the behavior he sometimes gets could indeed be a bug. Would be good to have a bug report, and it would be good if Alexandre would try to find a recipe so that we can find out what's going on (this could also be caused by some add on package) and fix the issue when necessary. Michael. ^ permalink raw reply [flat|nested] 40+ messages in thread
* RE: Replacing huge hidden selection when pasting text 2016-01-03 2:25 ` Michael Heerdegen @ 2016-01-03 3:10 ` Drew Adams 2016-01-03 3:21 ` Drew Adams 0 siblings, 1 reply; 40+ messages in thread From: Drew Adams @ 2016-01-03 3:10 UTC (permalink / raw) To: Michael Heerdegen, help-gnu-emacs > > > Apologies for not following this thread. But offhand I'd say that > > > there's your problem right there: you enable `delete-selection-mode' > > > but you disable `transient-mark-mode'. That should be a no-no. > > > > Oh my dear, I managed to hit a no-no! But if it's a no-no why is it > > possible in the first place? Why ain't there a single warning? Where > > are emacs's no-nos listed? Where is the checkbox and message saying "I > > agree not to do any emacs no-no, even if I don't know what they are"? > > Are you serious? > > I think there was much confusion in the thread, no doubt did the > nihilistic tone of Alexandre inhibit a fruitful discussion. > > Drew only wanted to help. But I think he was wrong with what he said. > I think it's ok to use the two modes at the same time. In the sentence > Drew cited: > > When Delete Selection mode is enabled, Transient Mark mode is also > ^^ > enabled, typed text replaces the selection if the selection is active, > and DEL deletes the selection. > > I think there is an "and" missing, and the sentence means something > different from what we thought. In fact, until Emacs 24.4, `delete-selection-mode' explicitly turned on `transient-mark-mode', and the doc string was as I quoted it (and it was correct). No "and" was missing; t-m-mode was really enabled by d-s-mode. Emacs 24.3: (if (not delete-selection-mode) (remove-hook 'pre-command-hook 'delete-selection-pre-hook) (add-hook 'pre-command-hook 'delete-selection-pre-hook) (transient-mark-mode t)) ; <========= Starting with Emacs 24.4, d-s-mode no longer turns on t-m-mode. > The current docstring (in my Emacs 25) says: > When Delete Selection mode is enabled, typed text replaces the > selection if the selection is active. Otherwise, typed text is just > inserted at point regardless of any selection. > > With `transient-mark-mode' off, you can mark a region (i.e., turn on > transient mark mode temporarily) by hitting C-SPC twice. Only then does > delete-selection-mode replace the region. In any other case (when the > region is not visible, i.e. not active) transient-mark-mode is just off, > and delete-selection-mode should not delete the region, never. I think you are right. This is not the original design of d-s-mode, but was done when "temporary t-m-mode" was added (presumably precisely to avoid the kind of gotcha that bit Alexandre). > So I think the behavior he sometimes gets could indeed be a bug. Would > be good to have a bug report, and it would be good if Alexandre would > try to find a recipe so that we can find out what's going on (this could > also be caused by some add on package) and fix the issue when necessary. Agreed. (And maybe the doc string of `transient-mark-mode' should, like the Emacs manual (node `Disabled Transient Mark'), mention temporary activation of t-m-mode (via C-SPC C-SPC or C-u C-x C-x). ^ permalink raw reply [flat|nested] 40+ messages in thread
* RE: Replacing huge hidden selection when pasting text 2016-01-03 3:10 ` Drew Adams @ 2016-01-03 3:21 ` Drew Adams 0 siblings, 0 replies; 40+ messages in thread From: Drew Adams @ 2016-01-03 3:21 UTC (permalink / raw) To: Michael Heerdegen, help-gnu-emacs > Starting with Emacs 24.4, d-s-mode no longer turns on t-m-mode. I see now a note I made to myself that this change was made on or about 2013-12-11. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 0:11 ` Alexandre Oberlin ` (3 preceding siblings ...) 2016-01-03 2:25 ` Michael Heerdegen @ 2016-01-03 4:09 ` Yuri Khan 2016-01-03 5:08 ` Random832 [not found] ` <mailman.1572.1451797753.843.help-gnu-emacs@gnu.org> [not found] ` <mailman.1570.1451794187.843.help-gnu-emacs@gnu.org> [not found] ` <mailman.1564.1451787927.843.help-gnu-emacs@gnu.org> 6 siblings, 2 replies; 40+ messages in thread From: Yuri Khan @ 2016-01-03 4:09 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: help-gnu-emacs@gnu.org On Sun, Jan 3, 2016 at 6:11 AM, Alexandre Oberlin <alxobr@gmail.com> wrote: > Enabling delete-selection-mode and disabling transient-mark-mode is nothing more than what an average user unsatisfied with the default behavior would try at first in order to get a "Windows notepad" like behavior regarding selection and overwriting. No. A Windows Notepad–like behavior is what you get with transient-mark-mode, shift-select-mode, delete-selection-mode and cua-mode all enabled. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-03 4:09 ` Yuri Khan @ 2016-01-03 5:08 ` Random832 [not found] ` <mailman.1572.1451797753.843.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 40+ messages in thread From: Random832 @ 2016-01-03 5:08 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan <yuri.v.khan@gmail.com> writes: > On Sun, Jan 3, 2016 at 6:11 AM, Alexandre Oberlin <alxobr@gmail.com> wrote: > >> Enabling delete-selection-mode and disabling transient-mark-mode is >> nothing more than what an average user unsatisfied with the default >> behavior would try at first in order to get a "Windows notepad" like >> behavior regarding selection and overwriting. > > No. A Windows Notepad–like behavior is what you get with > transient-mark-mode, shift-select-mode, delete-selection-mode and > cua-mode all enabled. A) I think his point is that the user is frustrated and so goes for whatever knobs look shiny rather than making a reasoned decision about what options are most suited to their needs. B) Transient mark mode, AIUI, doesn't actually affect users who don't explicitly set the mark in any noticeable way. Correct me if I'm wrong. C) IMO delete-selection-mode should never cause text in a non-active region to be deleted. And I can't reproduce the behavior (not that I seriously expected to, given that it's apparently intermittent.) I do have a question for Alexandre, though... has this ever happened with typed text, or only pasting/yanking? ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1572.1451797753.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1572.1451797753.843.help-gnu-emacs@gnu.org> @ 2016-01-13 17:13 ` Alexandre Oberlin 2016-01-14 14:07 ` Stefan Monnier [not found] ` <mailman.2334.1452780465.843.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-13 17:13 UTC (permalink / raw) To: help-gnu-emacs On Sun, 03 Jan 2016 06:08:59 +0100, Random832 <random832@fastmail.com> wrote: > A) I think his point is that the user is frustrated and so goes for > whatever knobs look shiny rather than making a reasoned decision > about what options are most suited to their needs. Talk as you feel. > B) Transient > mark mode, AIUI, doesn't actually affect users who don't explicitly > set the mark in any noticeable way. I do set the mark. I use regions/selections, mind you. BTW, I enabled transient-mark-mode right now in order to test Yuri’s suggestion for emulating notepad, and I noticed that non highlighted regions get deleted with CTRL+W as well if transient-mark-mode is on. > C) IMO delete-selection-mode should never cause text in a non-active > region to be deleted. Again, it does. It does with paste, and maybe even more consistently with kill-region (also with transient-mark-mode on, see above). > And I can't reproduce the behavior (not that > I seriously expected to, given that it's apparently intermittent.) > I do have a question for Alexandre, though... has this ever happened > with typed text, or only pasting/yanking? I have no remembrance of this happening on an invisible region by typing, even typing the delete key. It only happens with kill-region or paste. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-13 17:13 ` Alexandre Oberlin @ 2016-01-14 14:07 ` Stefan Monnier [not found] ` <mailman.2334.1452780465.843.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 40+ messages in thread From: Stefan Monnier @ 2016-01-14 14:07 UTC (permalink / raw) To: help-gnu-emacs >> C) IMO delete-selection-mode should never cause text in a non-active >> region to be deleted. > Again, it does. It does with paste, and maybe even more consistently with > kill-region (also with transient-mark-mode on, see above). And it does not for me, starting from emacs -Q -f delete-selection-mode So please provide a detailed recipe to reproduce the problem (and send it to M-x report-emacs-bug). Stefan ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.2334.1452780465.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.2334.1452780465.843.help-gnu-emacs@gnu.org> @ 2016-01-14 15:35 ` Alexandre Oberlin 2016-01-14 16:11 ` Kaushal Modi ` (5 more replies) 0 siblings, 6 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-14 15:35 UTC (permalink / raw) To: help-gnu-emacs On Thu, 14 Jan 2016 15:07:03 +0100, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > So please provide a detailed recipe to reproduce the problem (and send > it to M-x report-emacs-bug). It might not conform to the "philosophy" behind transient-mark-mode, but in GNU Emacs 24.5.1 kill-region DOES CONSISTENTLY kill an invisible (unactivated) region, also when transient-mark-mode is enabled, and even if delete-selection-mode is off. However, I personally have usually no problem with that, since it is stable and the intent is killing text anyway: you just can type C-x C-x to be sure. On the other hand, I DID (several years ago already) and STILL DO have problems with the similar pasting issue, which is NOT stable. To get an invisible region while transient-mark-mode is OFF (that is "(transient-mark-mode -1)" in .emacs): 1. Open a file 2. Type CTRL+SPACE ONCE 3. Move the cursor with an arrow key 4. Type CTRL+W The invisible region gets killed, whatever the value of delete-selection-mode. To get an invisible region while transient-mark-mode is ON (that is "(transient-mark-mode +1)" in .emacs): 1. Open a file 2. Type CTRL+SPACE TWICE 3. Move the cursor with an arrow key 4. Type CTRL+W The invisible region gets killed, whatever the value of delete-selection-mode. As already repeated, the behavior with pasting is NOT consistent. There seems to be one state where it overwrites, and another state where it doesn’t, while in both states transient-mark-mode is OFF and delete-selection-mode is ON. I am not aware of any way to reliably change from one state to the other. Cheers, Alexandre ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 15:35 ` Alexandre Oberlin @ 2016-01-14 16:11 ` Kaushal Modi 2016-01-14 17:20 ` Eli Zaretskii 2016-01-14 16:36 ` Michael Heerdegen ` (4 subsequent siblings) 5 siblings, 1 reply; 40+ messages in thread From: Kaushal Modi @ 2016-01-14 16:11 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: Help Gnu Emacs mailing list Hi Alexandre, Can you do M-x describe-face RET region RET and tell us what you see. The fact that you mention that your selected region always stays "invisible" is bothering me. The region is probably getting selected and displayed but you probably just are not seeing it because of the "region" face. Possible reasons: - Resolution of colors on your system - Accessing a remote machine via something like VNC. I have personally seen VNC degrade the color resolution based on the network connection speed. Check this out: http://imgur.com/a/XkIyk Here the upper picture (where you can distinguish the background of the "sample" text) is a screenshot of my VNC session under normal conditions. The bottom picture (where the "sample" background blends with the rest of the background) is what I get under poor network connection or if I force my VNC to represent colors with just 256 options (8-bit color). So in summary, if you do M-x describe-face RET region RET and you see that the "sample"'s background is not distinguished from the rest, THAT's the problem! To temporarily fix it, do M-x customize-face RET region RET and change the Background color to anything that makes the "sample" in that buffer stand out and then see if the invisibility spell is broken. PS: All the developers who responded to you have been very polite. They all have been very helpful to me. I respect all of them. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 16:11 ` Kaushal Modi @ 2016-01-14 17:20 ` Eli Zaretskii 0 siblings, 0 replies; 40+ messages in thread From: Eli Zaretskii @ 2016-01-14 17:20 UTC (permalink / raw) To: Kaushal Modi; +Cc: email_via, help-gnu-emacs > From: Kaushal Modi <kaushal.modi@gmail.com> > Date: Thu, 14 Jan 2016 11:11:12 -0500 > Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org> > > Hi Alexandre, > > Can you do M-x describe-face RET region RET and tell us what you see. > > The fact that you mention that your selected region always stays > "invisible" is bothering me. > The region is probably getting selected and displayed but you probably just > are not seeing it because of the "region" face. No, there's no region face there. He describes a situation where the region is not highlighted, which is perfectly normal in Emacs if you disable transient-mark-mode (temporarily by C-SPC twice, or permanently by turning the mode off). C-w still kills the region, even if the region is not highlighted. There's no bug here. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 15:35 ` Alexandre Oberlin 2016-01-14 16:11 ` Kaushal Modi @ 2016-01-14 16:36 ` Michael Heerdegen 2016-01-14 16:41 ` Eli Zaretskii ` (3 subsequent siblings) 5 siblings, 0 replies; 40+ messages in thread From: Michael Heerdegen @ 2016-01-14 16:36 UTC (permalink / raw) To: help-gnu-emacs "Alexandre Oberlin" <email_via@migo.info> writes: > To get an invisible region while transient-mark-mode is OFF (that is > "(transient-mark-mode -1)" in .emacs): > 1. Open a file > 2. Type CTRL+SPACE ONCE > 3. Move the cursor with an arrow key > 4. Type CTRL+W > The invisible region gets killed, whatever the value of > delete-selection-mode. > > To get an invisible region while transient-mark-mode is ON (that is > "(transient-mark-mode +1)" in .emacs): > 1. Open a file > 2. Type CTRL+SPACE TWICE > 3. Move the cursor with an arrow key > 4. Type CTRL+W > The invisible region gets killed, whatever the value of > delete-selection-mode. That's normal, I think: C-w always kills, no matter whether the region is active or not. > As already repeated, the behavior with pasting is NOT > consistent. There seems to be one state where it overwrites, and > another state where it doesn’t, while in both states > transient-mark-mode is OFF and delete-selection-mode is ON. I am not > aware of any way to reliably change from one state to the other. That's bad, still, a bug report would be good to have. Michael. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 15:35 ` Alexandre Oberlin 2016-01-14 16:11 ` Kaushal Modi 2016-01-14 16:36 ` Michael Heerdegen @ 2016-01-14 16:41 ` Eli Zaretskii [not found] ` <mailman.2341.1452787916.843.help-gnu-emacs@gnu.org> ` (2 subsequent siblings) 5 siblings, 0 replies; 40+ messages in thread From: Eli Zaretskii @ 2016-01-14 16:41 UTC (permalink / raw) To: help-gnu-emacs > Date: Thu, 14 Jan 2016 16:35:40 +0100 > From: "Alexandre Oberlin" <email_via@migo.info> > > To get an invisible region while transient-mark-mode is OFF (that is > "(transient-mark-mode -1)" in .emacs): > 1. Open a file > 2. Type CTRL+SPACE ONCE > 3. Move the cursor with an arrow key > 4. Type CTRL+W > The invisible region gets killed, whatever the value of > delete-selection-mode. > > To get an invisible region while transient-mark-mode is ON (that is > "(transient-mark-mode +1)" in .emacs): > 1. Open a file > 2. Type CTRL+SPACE TWICE > 3. Move the cursor with an arrow key > 4. Type CTRL+W > The invisible region gets killed, whatever the value of > delete-selection-mode. The above is the intended behavior, it has nothing to do with delete-selection-mode. > As already repeated, the behavior with pasting is NOT consistent. There > seems to be one state where it overwrites, and another state where it > doesn’t, while in both states transient-mark-mode is OFF and > delete-selection-mode is ON. I am not aware of any way to reliably change > from one state to the other. A recipe, please. If you think it's a bug, of course. ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.2341.1452787916.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.2341.1452787916.843.help-gnu-emacs@gnu.org> @ 2016-01-14 16:45 ` Alexandre Oberlin 2016-01-14 17:05 ` Kaushal Modi 0 siblings, 1 reply; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-14 16:45 UTC (permalink / raw) To: help-gnu-emacs Hi Kaushal, Thanks for your suggestion. I am currently on Cygwin only, but I use different fonts on different systems, depending on what is available. If I explicitly define a region with e.g. SHIFT+arrow key, it is always perfectly visible. M-x describe-face RET region RET (after points 1.2.3. of previous message): Face: region (sample) (customize this face) Documentation: Basic face for highlighting the region. Defined in `faces.el'. Family: unspecified Foundry: unspecified Width: unspecified Height: unspecified Weight: unspecified Slant: unspecified Foreground: unspecified DistantForeground: unspecified Background: blue3 Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Inherit: unspecified When I say "invisible region", I mean that it appears just like normal text. > PS: All the developers who responded to you have been very polite. They > all have been very helpful to me. I respect all of them. Yeah, I even praised gnu.emacs.help in a blog of mine, and I stuck to GNU Emacs even when XEemacs was all the rage. But that apparently does not prevent GNU Emacs from self-immolation, notably on the altar of mainstream compatibility. Cheers, Alexandre ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 16:45 ` Alexandre Oberlin @ 2016-01-14 17:05 ` Kaushal Modi 0 siblings, 0 replies; 40+ messages in thread From: Kaushal Modi @ 2016-01-14 17:05 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: Help Gnu Emacs mailing list > When I say "invisible region", I mean that it appears just like normal text. Exactly, that's what I demonstrated in that screen shot. When the color resolution is very low, the selected region, the "sample", looks unselected, like rest of the text in the buffer. > Face: region (sample) (customize this face) I just wanted to know if the "sample" text in the above line looked distinguished, with a different background than the rest. I see that the Background value is blue3 (but I don't know what your default background value is). Pasting that text here would not justify that. So I linked to the screenshot images I took. If you do see that "sample" text with a different background, which more likely is, as you mentioned, > If I explicitly define a region with e.g. SHIFT+arrow key, it is always perfectly visible. , then we can throw out this reason for invisibility out of consideration. So it boils down to filing an emacs bug report as others mentioned, with a definitive recipe of how to recreate this problem in an emacs -Q session. FWIW, I have never this issue. I always have transient-mark-mode and delete-selection-mode enabled. In my emacs version (latest build from emacs-25 branch), transient-mark-mode is on by default and I have customized the delete-selection-mode to be t (default was nil). ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 15:35 ` Alexandre Oberlin ` (3 preceding siblings ...) [not found] ` <mailman.2341.1452787916.843.help-gnu-emacs@gnu.org> @ 2016-01-14 19:37 ` Stefan Monnier [not found] ` <mailman.2359.1452800411.843.help-gnu-emacs@gnu.org> 5 siblings, 0 replies; 40+ messages in thread From: Stefan Monnier @ 2016-01-14 19:37 UTC (permalink / raw) To: help-gnu-emacs > It might not conform to the "philosophy" behind transient-mark-mode, but in > GNU Emacs 24.5.1 kill-region DOES CONSISTENTLY kill an invisible > (unactivated) region, also when transient-mark-mode is enabled, and even if > delete-selection-mode is off. This part is normal. And under the control of `mark-even-if-inactive'. Stefan ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.2359.1452800411.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.2359.1452800411.843.help-gnu-emacs@gnu.org> @ 2016-01-14 23:41 ` Alexandre Oberlin 0 siblings, 0 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-14 23:41 UTC (permalink / raw) To: help-gnu-emacs On Thu, 14 Jan 2016 20:37:40 +0100, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >> It might not conform to the "philosophy" behind transient-mark-mode, >> but in >> GNU Emacs 24.5.1 kill-region DOES CONSISTENTLY kill an invisible >> (unactivated) region, also when transient-mark-mode is enabled, and >> even if >> delete-selection-mode is off. > > This part is normal. And under the control of `mark-even-if-inactive'. Sure. I initially made this remark as a simple precision to the following: On Sun, 03 Jan 2016 06:08:59 +0100, Random832 <random832@fastmail.com> wrote: > C) IMO delete-selection-mode should never cause text in a non-active > region to be deleted. The effectiveness of CTRL+W within transient-mark-mode is logical when one remembers that 2 CTRL+SPACE in a row actually disable temporarily transient-mark-mode. BTW I did not notice any difference when changing `mark-even-if-inactive'. Alexandre ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1570.1451794187.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1570.1451794187.843.help-gnu-emacs@gnu.org> @ 2016-01-13 16:42 ` Alexandre Oberlin 2016-01-13 17:54 ` Yuri Khan [not found] ` <mailman.2302.1452707668.843.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-13 16:42 UTC (permalink / raw) To: help-gnu-emacs On Sun, 03 Jan 2016 05:09:23 +0100, Yuri Khan <yuri.v.khan@gmail.com> wrote: > On Sun, Jan 3, 2016 at 6:11 AM, Alexandre Oberlin <alxobr@gmail.com> > wrote: > >> Enabling delete-selection-mode and disabling transient-mark-mode is >> nothing more than what an average user unsatisfied with the default >> behavior would try at first in order to get a "Windows notepad" like >> behavior regarding selection and overwriting. > > No. A Windows Notepad–like behavior is what you get with > transient-mark-mode, shift-select-mode, delete-selection-mode and > cua-mode all enabled. Sooo simple to emulate the sophisticated notepad ?? Actually your statement is not true (at least in GNU Emacs 24.5.1) If I set the mark with all that you mention enabled, then the region is extended and highlighted when pressing the arrow keys without SHIFT, as well as while isearching. This is exactly what I want to avoid and it never happen in notepad. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-13 16:42 ` Alexandre Oberlin @ 2016-01-13 17:54 ` Yuri Khan [not found] ` <mailman.2302.1452707668.843.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 40+ messages in thread From: Yuri Khan @ 2016-01-13 17:54 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: help-gnu-emacs@gnu.org On Wed, Jan 13, 2016 at 10:42 PM, Alexandre Oberlin <email_via@migo.info> wrote: >> No. A Windows Notepad–like behavior is what you get with >> transient-mark-mode, shift-select-mode, delete-selection-mode and >> cua-mode all enabled. > > Sooo simple to emulate the sophisticated notepad ?? > Actually your statement is not true (at least in GNU Emacs 24.5.1) > If I set the mark with all that you mention enabled, then the region is > extended and highlighted when pressing the arrow keys without SHIFT, as well > as while isearching. This is exactly what I want to avoid and it never > happen in notepad. Notepad does not have the notion of setting the mark. For accurate emulation, do not do that. ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.2302.1452707668.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.2302.1452707668.843.help-gnu-emacs@gnu.org> @ 2016-01-14 13:57 ` Alexandre Oberlin 0 siblings, 0 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-14 13:57 UTC (permalink / raw) To: help-gnu-emacs On Wed, 13 Jan 2016 18:54:04 +0100, Yuri Khan <yuri.v.khan@gmail.com> wrote: > Notepad does not have the notion of setting the mark. For accurate > emulation, do not do that. I am personally not trying to have Emacs limited to Notepad’s behavior! But if a user does, he will be disappointed, because the mark gets implicitly defined all the time, after an isearch for example. ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.1564.1451787927.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.1564.1451787927.843.help-gnu-emacs@gnu.org> @ 2016-01-13 17:26 ` Alexandre Oberlin 0 siblings, 0 replies; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-13 17:26 UTC (permalink / raw) To: help-gnu-emacs Hi again, On Sun, 03 Jan 2016 03:25:04 +0100, Michael Heerdegen <michael_heerdegen@web.de> wrote: > With `transient-mark-mode' off, you can mark a region (i.e., turn on > transient mark mode temporarily) by hitting C-SPC twice. Only then does > delete-selection-mode replace the region. AFAIK, the region is empty just after you have hit CTRL+SPACE twice, so there is no risk of overwriting anything. > In any other case (when the > region is not visible, i.e. not active) transient-mark-mode is just off, > and delete-selection-mode should not delete the region, never. But it does, often. > So I think the behavior he sometimes gets could indeed be a bug. Would > be good to have a bug report, and it would be good if Alexandre would > try to find a recipe so that we can find out what's going on (this could > also be caused by some add on package) and fix the issue when necessary. On some occasions the behavior changed after coming back from suspend... I usually navigate in Emacs using the arrow keys and isearch rather than kidding around with the mouse and wheel. I can't stand transient mode because with it I must spend a significant portion of my typing trying to get rid of annoying highlighting. I must press CTRL+SPACE twice in a row to avoid highlighting and selecting stuff when moving or isearching. Moreover, as I already stressed, pressing CTRL+SPACE twice is also necessary to be SURE not to overwrite a non highlighted region in some still undefined but frequent circumstances, so I’d better not forget about it. THIS IS A TERRIBLE ERRATIC BUG IN EMACS. Allowing the user to make selections and define active region without pressing SHIFT is extremely valuable as an accessibility feature for a person having definitely or temporarily lost the use of one hand. It is in the same vein as allowing selection of multiple check boxes without pressing SHIFT and is great for persons with such handicaps. However those should be accessibility features, and I don't think that making arrows keys select text by default in Emacs is an extremely brilliant idea. To conclude, I would like to emphasize: A) that it happens on quite different versions/systems, e.g. Cygwin and Ubuntu Live. B) that I can’t afford spending hours or days on this. Cheers, ^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <mailman.528.1450998293.843.help-gnu-emacs@gnu.org>]
* Re: Replacing huge hidden selection when pasting text [not found] ` <mailman.528.1450998293.843.help-gnu-emacs@gnu.org> @ 2016-01-14 14:00 ` Alexandre Oberlin 2016-01-14 15:02 ` Stefan Monnier 0 siblings, 1 reply; 40+ messages in thread From: Alexandre Oberlin @ 2016-01-14 14:00 UTC (permalink / raw) To: help-gnu-emacs On Fri, 25 Dec 2015 00:04:38 +0100, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > The way you start Emacs will determine what C-y does, so your recipe is > hopelessly incomplete. C-y runs the command yank, which is an interactive compiled Lisp function in `simple.el'. ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2016-01-14 14:00 ` Alexandre Oberlin @ 2016-01-14 15:02 ` Stefan Monnier 0 siblings, 0 replies; 40+ messages in thread From: Stefan Monnier @ 2016-01-14 15:02 UTC (permalink / raw) To: help-gnu-emacs >> The way you start Emacs will determine what C-y does, so your recipe is >> hopelessly incomplete. > C-y runs the command yank, which is an interactive compiled Lisp > function in `simple.el'. So it looks like you know enough already and don't need any help, Stefan ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 1:01 Replacing huge hidden selection when pasting text Alexandre Oberlin 2015-12-24 1:37 ` Drew Adams @ 2015-12-24 5:48 ` Pascal J. Bourguignon 2015-12-24 14:40 ` Andreas Röhler 2015-12-27 22:15 ` Robert Thorpe 3 siblings, 0 replies; 40+ messages in thread From: Pascal J. Bourguignon @ 2015-12-24 5:48 UTC (permalink / raw) To: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > I have stopped hoping that the current maintainers of Emacs still have > an ounce of common sense. How on Earth can it be possible (and quite > easy) to allow replacing a huge hidden selection when pasting text > without any warning ? I have lost large amounts of data with this > incredibly stupid behavior. There isn't even a warning when saving a > file which has shrunk a lot, like there once was. How can I DEFINITELY > avoid overwriting an invisible selection in all versions of Emacs? This is not possible, with the default configuration of emacs. You must have explicitely asked for it, in your ~/.emacs file. To get this behavior, I had to put: (defun delete-region-and-yank (&optional arg) "Deletes region if mark is active and yanks the last kill. Always replaces the region with the yank, whether the region was selected via keyboard or mouse. Also works for normal yank even with ARGS (thus it can be mapped to \C-y)" (interactive "*P") ; raw, like yank. (cond (mark-active ; delete region (let ((str (buffer-substring (point) (mark)))) (delete-region (point) (mark)) (if (cl:string= str (current-kill 0 1)) (let ((str2 (current-kill 1 1))) (kill-new str2 t)))) (if arg (yank arg) (yank))) ;; else no region selected: ((consp arg) ; delete forward sexp (set-mark (point)) (forward-sexp 1) (delete-region-and-yank)) (arg (yank arg)) (t (yank)))) (global-set-key (kbd "C-y") 'delete-region-and-yank) in my ~/.emacs ! By default, C-y is bound to yank, which inserts the text from the kill ring at the end of the region. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 1:01 Replacing huge hidden selection when pasting text Alexandre Oberlin 2015-12-24 1:37 ` Drew Adams 2015-12-24 5:48 ` Pascal J. Bourguignon @ 2015-12-24 14:40 ` Andreas Röhler 2015-12-27 22:15 ` Robert Thorpe 3 siblings, 0 replies; 40+ messages in thread From: Andreas Röhler @ 2015-12-24 14:40 UTC (permalink / raw) To: help-gnu-emacs On 24.12.2015 02:01, Alexandre Oberlin wrote: > I have stopped hoping that the current maintainers of Emacs still have an ounce of common sense. How on Earth can it be possible (and quite easy) to allow replacing a huge hidden selection when pasting text without any warning ? I have lost large amounts of data with this incredibly stupid behavior. There isn't even a warning when saving a file which has shrunk a lot, like there once was. How can I DEFINITELY avoid overwriting an invisible selection in all versions of Emacs? > Hi Alexandre, as Pascal responded already, assuming such thing seems wrong. Nonetheless thanks coming forward with this. All kind of mistakes happen, let's speak about and solve it rather than mimic for the sake of CoCs. Also there is a trade between freedom and security. Emacs tends to the first AFAIU. Cheers, Andreas ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: Replacing huge hidden selection when pasting text 2015-12-24 1:01 Replacing huge hidden selection when pasting text Alexandre Oberlin ` (2 preceding siblings ...) 2015-12-24 14:40 ` Andreas Röhler @ 2015-12-27 22:15 ` Robert Thorpe 3 siblings, 0 replies; 40+ messages in thread From: Robert Thorpe @ 2015-12-27 22:15 UTC (permalink / raw) To: Alexandre Oberlin; +Cc: help-gnu-emacs Alexandre Oberlin <alxobr@gmail.com> writes: > I have stopped hoping that the current maintainers of Emacs still have > an ounce of common sense. How on Earth can it be possible (and quite > easy) to allow replacing a huge hidden selection when pasting text > without any warning ? I have lost large amounts of data with this > incredibly stupid behavior. There isn't even a warning when saving a > file which has shrunk a lot, like there once was. How can I DEFINITELY > avoid overwriting an invisible selection in all versions of Emacs? If "delete-selection-mode" is enabled then typed text will replace the selection. It only works with transient mark mode on. That could be the problem, though in that case the selection should be visible. If not, I suggest checking your init file. A piece of code could rely on the specific behaviour of an earlier version of Emacs. Emacs -Q is the test. BR, Robert Thorpe ^ permalink raw reply [flat|nested] 40+ messages in thread
end of thread, other threads:[~2016-01-14 23:41 UTC | newest] Thread overview: 40+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-24 1:01 Replacing huge hidden selection when pasting text Alexandre Oberlin 2015-12-24 1:37 ` Drew Adams 2015-12-24 13:27 ` Alexandre Oberlin 2015-12-24 23:04 ` Stefan Monnier 2015-12-25 1:18 ` Pascal J. Bourguignon [not found] ` <mailman.529.1451006347.843.help-gnu-emacs@gnu.org> 2016-01-02 21:40 ` Alexandre Oberlin 2016-01-02 22:03 ` Marcin Borkowski [not found] ` <mailman.1550.1451772215.843.help-gnu-emacs@gnu.org> 2016-01-02 22:28 ` Alexandre Oberlin 2016-01-02 23:04 ` Drew Adams [not found] ` <mailman.1551.1451775915.843.help-gnu-emacs@gnu.org> 2016-01-03 0:11 ` Alexandre Oberlin 2016-01-03 0:28 ` Michael Heerdegen [not found] ` <mailman.1554.1451780942.843.help-gnu-emacs@gnu.org> 2016-01-03 0:41 ` Alexandre Oberlin 2016-01-03 1:07 ` Michael Heerdegen 2016-01-03 2:10 ` Robert Thorpe 2016-01-03 2:11 ` Drew Adams 2016-01-03 2:25 ` Michael Heerdegen 2016-01-03 3:10 ` Drew Adams 2016-01-03 3:21 ` Drew Adams 2016-01-03 4:09 ` Yuri Khan 2016-01-03 5:08 ` Random832 [not found] ` <mailman.1572.1451797753.843.help-gnu-emacs@gnu.org> 2016-01-13 17:13 ` Alexandre Oberlin 2016-01-14 14:07 ` Stefan Monnier [not found] ` <mailman.2334.1452780465.843.help-gnu-emacs@gnu.org> 2016-01-14 15:35 ` Alexandre Oberlin 2016-01-14 16:11 ` Kaushal Modi 2016-01-14 17:20 ` Eli Zaretskii 2016-01-14 16:36 ` Michael Heerdegen 2016-01-14 16:41 ` Eli Zaretskii [not found] ` <mailman.2341.1452787916.843.help-gnu-emacs@gnu.org> 2016-01-14 16:45 ` Alexandre Oberlin 2016-01-14 17:05 ` Kaushal Modi 2016-01-14 19:37 ` Stefan Monnier [not found] ` <mailman.2359.1452800411.843.help-gnu-emacs@gnu.org> 2016-01-14 23:41 ` Alexandre Oberlin [not found] ` <mailman.1570.1451794187.843.help-gnu-emacs@gnu.org> 2016-01-13 16:42 ` Alexandre Oberlin 2016-01-13 17:54 ` Yuri Khan [not found] ` <mailman.2302.1452707668.843.help-gnu-emacs@gnu.org> 2016-01-14 13:57 ` Alexandre Oberlin [not found] ` <mailman.1564.1451787927.843.help-gnu-emacs@gnu.org> 2016-01-13 17:26 ` Alexandre Oberlin [not found] ` <mailman.528.1450998293.843.help-gnu-emacs@gnu.org> 2016-01-14 14:00 ` Alexandre Oberlin 2016-01-14 15:02 ` Stefan Monnier 2015-12-24 5:48 ` Pascal J. Bourguignon 2015-12-24 14:40 ` Andreas Röhler 2015-12-27 22:15 ` Robert Thorpe
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).