smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

smartparens still does not work with delete-selection-mode

Open DrWaleedAYousef opened this issue 7 years ago • 12 comments

Expected behavior

wrapping even if I do (delete-selection-mode 1) in the .emacs file

Actual behavior

the selection is deleted

Steps to reproduce the problem

just select any word and do, e.g., $ or \

Backtraces if necessary (M-x toggle-debug-on-error)

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

  • smartparens version:

  • Active major-mode: LaTeX

  • Emacs version (M-x emacs-version): GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05

  • Spacemacs/Evil/Other starterkit (specify which)/Vanilla: The three appear when pressing sp-describe-system

  • OS: ArchLinux last update (as today)

DrWaleedAYousef avatar Sep 05 '18 00:09 DrWaleedAYousef

I can not reproduce this. I'm on emacs -nw -q 26.1 with loading just dash and smartparens and smartparens-latex, enabling smartparens and delete-selection-mode. Both wrapping and delete selection works.

Can you try to reproduce this with a minimal setup?

Fuco1 avatar Sep 05 '18 09:09 Fuco1

If you have cask you can clone this repo, then cask install and cask emacs -nw -q then load the necessary packages.

Fuco1 avatar Sep 05 '18 09:09 Fuco1

Thanks so much; I, as well, have 26.1. Please find the minimal setup for reproducing the problem. Just highlight any word in a .tex file and press $ it will be deleted not wrapped. Another issue related to the tag wrapping; it does not work even when commenting the delete-selection-mode.

(package-initialize)

(delete-selection-mode 1)

(require 'smartparens-config)
(require 'smartparens-latex)
(add-hook 'js-mode-hook #'smartparens-mode)

(smartparens-global-mode t)
(show-smartparens-global-mode t)
(setq sp-base-key-bindings (quote sp))

;; Also, the following line does not wrap a selection even when commenting the delete-selection-mode
(sp-local-tag '(tex-mode plain-tex-mode latex-mode LaTeX) "\\b" "\\begin{_}" "\\end{_}")

(define-key smartparens-mode-map (kbd "<delete>") 'sp-delete-char)
(define-key smartparens-mode-map (kbd "M-<delete>") 'sp-kill-word)
(define-key smartparens-mode-map (kbd "C-<delete>") 'sp-unwrap-sexp)
(define-key smartparens-mode-map (kbd "C-M-<delete>") 'sp-kill-sexp)
(define-key smartparens-mode-map (kbd "C-k") 'sp-kill-hybrid-sexp)
(define-key smartparens-mode-map (kbd "C-S-<delete>") 'sp-splice-sexp-killing-forward)
(define-key smartparens-mode-map (kbd "<backspace>") 'sp-backward-delete-char)
(define-key smartparens-mode-map (kbd "M-<backspace>") 'sp-backward-kill-word)
(define-key smartparens-mode-map (kbd "C-<backspace>") 'sp-backward-unwrap-sexp)
(define-key smartparens-mode-map (kbd "C-M-<backspace>") 'sp-backward-kill-sexp)
(define-key smartparens-mode-map (kbd "C-S-<backspace>") 'sp-splice-sexp-killing-backward)
(bind-key "M-s r" 'sp-rewrap-sexp smartparens-mode-map)
(bind-key "M-s s" 'sp-split-sexp smartparens-mode-map)
(bind-key "M-s j" 'sp-join-sexp smartparens-mode-map)
(define-key smartparens-mode-map (kbd "C-<right>") 'sp-forward-slurp-sexp)
(define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-barf-sexp)
(define-key smartparens-mode-map (kbd "C-M-<left>") 'sp-backward-slurp-sexp)
(define-key smartparens-mode-map (kbd "C-M-<right>") 'sp-backward-barf-sexp)
(define-key smartparens-mode-map (kbd "C-M-f") 'sp-forward-sexp)
(define-key smartparens-mode-map (kbd "C-M-b") 'sp-backward-sexp)
(define-key smartparens-mode-map (kbd "C-M-e") 'sp-up-sexp)
(define-key smartparens-mode-map (kbd "C-M-a") 'sp-backward-up-sexp)

(use-package auctex
  :defer t
  :ensure t)

DrWaleedAYousef avatar Sep 05 '18 19:09 DrWaleedAYousef

Tags no longer work. I did not load auctex so I think that's where the problem is.

Fuco1 avatar Sep 05 '18 20:09 Fuco1

You are right; I commented the auctex load and kept all of my .emacs configuration, and the problem gone. So, what do you suggest now? Are you planing to fix this in smartparens?

DrWaleedAYousef avatar Sep 05 '18 22:09 DrWaleedAYousef

Yes I think we need to fix it, auctex is pretty much the only sane way to author latex in emacs.

Fuco1 avatar Sep 06 '18 09:09 Fuco1

By the way thanks for narrowing this down, good job! Makes it a lot easier to find a fix.

Fuco1 avatar Sep 06 '18 09:09 Fuco1

Thanks so much for your support.

On Thu, Sep 6, 2018, 11:56 AM Matus Goljer [email protected] wrote:

By the way thanks for narrowing this down, good job! Makes it a lot easier to find a fix.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Fuco1/smartparens/issues/926#issuecomment-419036213, or mute the thread https://github.com/notifications/unsubscribe-auth/ALpbzXfs6e2mjf4HvpGJNbWIx_4dkiBFks5uYPFGgaJpZM4WZ_oe .

DrWaleedAYousef avatar Sep 06 '18 13:09 DrWaleedAYousef

There was a super nasty bug with some caching I've fixed this morning. Can you try the latest master to see if the issue persists?

Fuco1 avatar Oct 27 '18 12:10 Fuco1

Thanks so much for your efforts, unfortunately, the problem is the same!

DrWaleedAYousef avatar Oct 27 '18 13:10 DrWaleedAYousef

@DrWaleedAYousef Thanks for confirming. I'm sure we'll figure it out eventually /shrug

Fuco1 avatar Oct 27 '18 14:10 Fuco1

I confirm that the issue is still present.

temyurchenko avatar Mar 25 '24 21:03 temyurchenko