smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

sp-backward-symbol does not skip over comment in Erlang code.

Open pierre-rouleau opened this issue 4 years ago • 2 comments

Expected behavior

With located at position marked by ∎ in following Erlang code in erlang-mode buffer:

start_app(App) ->                 % first clause                                                                           
    ∎start_app(App, temporary).

Executing M-x sp-backward-symbol should move point to the beginning of previous symbol, which happens to be App:

start_app(∎App) ->                 % first clause                                                                           
    start_app(App, temporary).

Actual behavior

Instead it lands right inside the comment:

start_app(App) ->                 % first ∎clause                                                                           
    start_app(App, temporary).

Note:

  • sp-skip-forward-to-symbol skips over comments.
  • sp-forward-symbol also stops within comments.
  • I would expect to see both sp-forward-symbol and sp-backward-symbol to skip comments.

Steps to reproduce the problem

  • Open an Erlang file, type the following code, activate smartparens-mode and do what's in the example above.

Environment & version information

  • smartparens version: 20210529.1129. Also tested on version 20210904.1621 with same results.
  • Active major-mode: erlang-mode
  • Smartparens strict mode: nil
  • Emacs version (M-x emacs-version): GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.6.0) of 2019-08-30
  • Starterkit/Distribution: Vanilla
  • OS: darwin

pierre-rouleau avatar Sep 21 '21 19:09 pierre-rouleau

I looked at the code and both sp-forward-symbol and sp-backward-symbol do no skip comment. I beleive they should (or at least have a user-option that would control the behaviour). I will submit a PR to skip the comments.

pierre-rouleau avatar Sep 30 '21 14:09 pierre-rouleau

PR submitted.

pierre-rouleau avatar Sep 30 '21 14:09 pierre-rouleau