1

I've installed the smartparens package, and features involving the normal pairs (parenthesis, brackets, curly braces, etc...) work fine; however, none of the features around tags (html tags for example) work for me. In particular, I can't get wrapping a selection in an html tag or auto-completing closing html tags to work in html-mode. Here's the relevant portion of my .emacs file, where I install the smartparens package:

(require 'smartparens-config)
(smartparens-global-mode t)
(show-smartparens-global-mode t)
(setq sp-show-pair-delay 0)

;; print offscreen matches in the echo buffer
(require 's)
;; show matching parens on steroids
(defadvice sp-show--pair-function
  (after sp-show--pair-function-offscreen activate)
  "If the matching paren is offscreen, show the matching line in the
          echo area."
  (interactive)
  (let ((vis-buf (save-excursion
           (cons (progn (move-to-window-line 0) (point))
             (progn (move-to-window-line -1) (line-end-position)))))
    (matching-sexp (if (and (sp-get (sp-get-sexp nil) :beg)
                (= (point) (sp-get (sp-get-sexp nil) :beg)))
               (cons (sp-get (sp-get-sexp nil) :beg)
                 (sp-get (sp-get-sexp nil) :end))
             (if (and (sp-get (sp-get-sexp t) :end)
                  (= (point) (sp-get (sp-get-sexp t) :end)))
                 (cons (sp-get (sp-get-sexp t) :beg)
                   (sp-get (sp-get-sexp t) :end))
               nil))))
    (when matching-sexp
      (if (> (car vis-buf)
         (car matching-sexp))
      ;; opening delim is offscreen
      (message "Matches %s"
           (s-trim
            (save-excursion (goto-char (car matching-sexp))
                    (thing-at-point 'line))))
    (if (< (cdr vis-buf)
           (cdr matching-sexp))
        ;; closing delim is offscreen
        (message "Matches %s"
             (s-trim
              (save-excursion (goto-char (cdr matching-sexp))
                      (thing-at-point 'line)))))))))

The long second piece is a snippet from this issue on github. I've been searching around awhile for a solution to this. Is there a key combination I need to use in order to start a 'tag' as opposed to a 'pair'? I'm using emacs 24.3, and I also have the packages linum-relative, autocomplete, auctex, and a couple others installed.

  • Welcome. It is not clear to me exactly what your question is. You say at the top the code is working. Can you update your posting please. – Andrew Swann Mar 20 '15 at 6:54
  • Thanks Andrew. The code is working for some of the features, namely features involving a normal delimiter or parenthesis; however, it doesn't work for things like html tags, etc... – Nick Mar 20 '15 at 8:46
2

It turns out that the tag completion feature has been removed from the current version of smartparens. If you want to have tag completion, then you need to install the stable version, 1.6.3 from MELPA's stable package listing.

  • Is this still the case? This is several months ago now. – ocodo Jul 20 '15 at 5:58
  • I'd say if you're not having the problem with the current build, great! Otherwise, use 1.6.3 if you really want the functionality. – Nick Sep 21 '15 at 23:30
  • @EmacsFodder yup, still the case. I checked in with Matúš today and he says the tag system didn't play well with everything else, so he's slowly working on internals to clean up and then add the tag feature again. So it should be more awesome when it's all done again, but it's going to take some time. – Aaron Schumacher Nov 26 '15 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.