Comments (4)
Is it just me or do things stop working after a couple of kill-regions? After I killed a region with a mark, I don't see a mark anymore but when I wipe it kills an unexpected region of text. I was also using undo so it's possible it got confused there.
from lem.
I think this may work:
(define-command kill-region-or-line () ()
"Kill the text of region or the current line if no region."
(if (buffer-mark (current-buffer))
(kill-region (region-beginning)
(region-end))
(and (line-start (current-point))
(kill-whole-line))))
Keep in mind that this doesn't work with the vi-mode visual line, mostly because it doesn't uses the emacs-mode mark
from lem.
I also wrote.
(defmethod execute :around (mode (command kill-region) argument)
(if (buffer-mark-p (current-buffer))
(call-next-method)
(with-point ((start (current-point))
(end (current-point)))
(line-start start)
(line-offset end 1)
(kill-region start end))))
from lem.
Thanks
@Sasanidas your implementation causes the cursor to move up after kiling the line. Also the killed line doesn't include the newline character.
@cxxxr I think your implementation has the same issue as mine where it wouldn't kill the last line in the buffer. I didn't know about execute :around
. That's pretty neat.
I wrote another implementation but need to fine tune it because it doesn't work with the first line in the buffer.
from lem.
Related Issues (20)
- Can't invoke built-in commands with M-x (release binaries) HOT 5
- Lisp find definition doesn't always work HOT 4
- Assertion failure when launching Lem SDL2 on Crostini Linux HOT 32
- async-process broken on SDL2 frontend HOT 6
- SDL2 can't display correctly some polish characters HOT 2
- In ncurses version I can't type some polish characters HOT 4
- Directory mode bug: deleting soft link is dangerous! HOT 3
- In SDL2 version, resizing with yes/no dialog open kills lem HOT 2
- Confirmation Prompt on Recursive Deletion HOT 3
- Process stdio mishandled in `lsp-mode`'s stdio client HOT 8
- Slow SDL2 GUI (found the cause) HOT 7
- C-x e problem HOT 2
- completion-mode bug HOT 3
- Cannot start lem again after exit HOT 2
- Tabs buffer-v1 vs. buffer-v2 HOT 5
- Prompt color changes when lem is closed. HOT 2
- Installation with sbcl doesn't work anymore HOT 3
- make cannot find lem-ncurses in lem directory HOT 1
- v2.1.0 binary does not work on macOS Sonoma HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lem.