smartparens
smartparens copied to clipboard
show-smartparens hanging when cursor on the right parenthesis
Expected Behavior
No hanging.
Actual Behavior
Hanging for a long while when cursor moves to the right parenthesis (} and ) and ] ).
Steps to reproduce the behavior
$ /path/to/emacs -nw -Q -l /path/to/test-smartparens.el
Environment
- smartparens-20171117.633
- Emacs 25.3.1 / 26.0.50 / 26.0.90 / 27.0.50
- macOS 10.11.6
;;; Usage: /path/to/emacs -nw -Q -l /path/to/test-smartparens.el
(toggle-debug-on-error)
(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "M-h") 'backward-kill-word)
(global-set-key (kbd "<f1>") 'help-command)
(define-key isearch-mode-map "\C-h" 'isearch-delete-char)
(setq package-user-dir
(concat
user-emacs-directory
(format "elpa--%s/%s" (file-name-base load-file-name) emacs-version)))
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(defun require-packages (&rest packages)
(dolist (pkg packages)
(unless (package-installed-p pkg)
(package-refresh-contents)
(package-install pkg))
(require pkg)))
(require-packages
'smartparens
'php-mode
)
;; ------------------------------------------------------------------
(smartparens-global-mode)
;; Instead of `show-smartparens-global-mode',
;; enable built-in `show-paren-mode' for testing.
(show-paren-mode)
(define-key smartparens-mode-map (kbd "C-M-f") 'sp-forward-sexp)
(define-key smartparens-mode-map (kbd "C-M-b") 'sp-backward-sexp)
(defun test-data ()
(let ((fmt "array('name' => 'node%d', 'path' => 'path%d', 'class' => 'Class%d', 'method' => 'method%d'"))
(with-temp-buffer
(insert "<?php\n")
(insert "return array(\n")
(dotimes (i 6)
(insert (concat " " (format fmt i i i i) ", 'children' => array(\n"))
(dotimes (j 6)
(insert (concat " " (format fmt j j j j) ", 'children' => array(\n"))
(dotimes (k 6)
(insert (concat " " (format fmt k k k k) ", 'children' => array(\n"))
(dotimes (l 6)
(insert (concat " " (format fmt l l l l) "),\n")))
(insert " )),\n"))
(insert " )),\n"))
(insert " )),\n"))
(insert ");")
(buffer-string))))
(add-hook 'after-init-hook
'(lambda ()
;; data
(switch-to-buffer "*.php")
(php-mode)
(insert
(test-data))
;; test
(goto-char (- (point-max) 2))
(let ((begin-time (current-time)))
(sp-get-paired-expression)
(message
(format "(sp-get-paired-expression) completed in %3fs"
(- (float-time (current-time)) (float-time begin-time)))))))
(run-hooks 'after-init-hook)
;;; test-smartparens.el ends here
This seems to be related / duplicate of #868