[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 6b5fe38 204/495: write our own implementation of g
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 6b5fe38 204/495: write our own implementation of go--delete-whole-line |
Date: |
Sat, 7 Aug 2021 09:05:14 -0400 (EDT) |
branch: elpa/go-mode
commit 6b5fe389cb5bdd75f52c349b6be8915fb9913d10
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
write our own implementation of go--delete-whole-line
Using flet to replace kill-region with delete-region was a hack, flet is
deprecated and at least two people (probably due to a bug in a third
party package) have had their kill ring broken by our hack.
---
go-mode.el | 52 +++++++++++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 17 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 55ac3f8..330a51b 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -42,29 +42,47 @@
;; - Use go--old-completion-list-style when using a plain list as the
;; collection for completing-read
;;
-;; - Use go--kill-whole-line instead of kill-whole-line (called
-;; kill-entire-line in XEmacs)
-;;
;; - Use go--position-bytes instead of position-bytes
(defmacro go--xemacs-p ()
`(featurep 'xemacs))
-(defalias 'go--kill-whole-line
- (if (fboundp 'kill-whole-line)
- #'kill-whole-line
- #'kill-entire-line))
-
;; Delete the current line without putting it in the kill-ring.
(defun go--delete-whole-line (&optional arg)
- ;; Emacs uses both kill-region and kill-new, Xemacs only uses
- ;; kill-region. In both cases we turn them into operations that do
- ;; not modify the kill ring. This solution does depend on the
- ;; implementation of kill-line, but it's the only viable solution
- ;; that does not require to write kill-line from scratch.
- (flet ((kill-region (beg end)
- (delete-region beg end))
- (kill-new (s) ()))
- (go--kill-whole-line arg)))
+ (setq arg (or arg 1))
+ (if (and
+ (> arg 0)
+ (eobp)
+ (save-excursion (forward-visible-line 0) (eobp)))
+ (signal 'end-of-buffer nil))
+ (if (and
+ (< arg 0)
+ (bobp)
+ (save-excursion (end-of-visible-line) (bobp)))
+ (signal 'beginning-of-buffer nil))
+
+ (let (start-point
+ end-point)
+ (cond ((zerop arg)
+ (forward-visible-line 0)
+ (setq start-point (point))
+
+ (end-of-visible-line)
+ (setq end-point (point)))
+ ((< arg 0)
+ (end-of-visible-line)
+ (setq start-point (point))
+
+ (forward-visible-line (1+ arg))
+ (unless (bobp)
+ (backward-char))
+ (setq end-point (point)))
+ (t
+ (forward-visible-line 0)
+ (setq start-point (point))
+
+ (forward-visible-line arg)
+ (setq end-point (point))))
+ (delete-region start-point end-point)))
;; declare-function is an empty macro that only byte-compile cares
;; about. Wrap in always false if to satisfy Emacsen without that
- [nongnu] elpa/go-mode 7e22639 215/495: remove LEGAL, treat this repository as a mirror of misc/emacs, (continued)
- [nongnu] elpa/go-mode 7e22639 215/495: remove LEGAL, treat this repository as a mirror of misc/emacs, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 903fb9e 216/495: Cancel narrowing before gofmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 21cba0e 220/495: add gofmt-show-errors option, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 731b93c 152/495: godef: instead of printing just the first line of a definition, print all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6e1d5ea 162/495: bump version, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5a58bda 149/495: bump version, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a55aa42 168/495: add pledgie to the readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 115b2eb 171/495: add go-coverage to readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b0d4379 175/495: fix for eea3ccf, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2089798 200/495: ignore backquote in comment or string, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6b5fe38 204/495: write our own implementation of go--delete-whole-line,
ELPA Syncer <=
- [nongnu] elpa/go-mode 1319be5 210/495: simplify godoc-at-point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 61aafe9 218/495: Allow spaces after "chan<-", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 078d5d8 229/495: Use utf-8 when calling godef, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d900f72 060/495: extend indentation_tests/gh-15.go, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 846ed32 063/495: optimizations, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e184d60 070/495: Replace go--directory-dirs with find-lisp-find-files-internal, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 56ab2c8 088/495: make sure kill-line in go-remove-unused-imports includes \n, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0b32caa 093/495: fix usage of url-* functions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1fdbcbf 095/495: use line-number-at-pos isntead of count-lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7512759 104/495: Merge branch 'master' of https://github.com/imarko/go-mode.el into imarko-master, ELPA Syncer, 2021/08/07