0

I have the following code and wonder whether I can define the variable brace-stxcode in the let* part rather than I currently do (make a new let).

  (let* ( (last-ppss-pos (point))
          (ppss (syntax-ppss)) )

    (while (> end (progn (skip-syntax-forward "^()" end)
                         (point) ))

      (let* ( (brace-pos (point))
              (brace-stx (syntax-after brace-pos)) )

        (setq ppss
              (parse-partial-sexp last-ppss-pos brace-pos nil nil ppss))
        (setq last-ppss-pos brace-pos)

        (forward-char)
    
        (let ( (brace-stxcode (car brace-stx)) )  ; <= from here to let*

          (cond
           ((conshine-ignore brace-pos ppss brace-stxcode)
               nil)

           ((= 4 (logand #xFFFF brace-stxcode))
               (conshine-colourise brace-pos (1+ (nth 0 ppss)) t))

           (t
               (let ( (matches-p
                       (eq (cdr brace-stx) (char-after (nth 1 ppss)))) )
                 (conshine-colourise brace-pos (nth 0 ppss) matches-p)) ))) )))

1 Answer 1

0

Yes, why not?

(let* ((last-ppss-pos (point))
       (ppss (syntax-ppss)))
  (while (> end (progn (skip-syntax-forward "^()" end) (point)))
    (let* ((brace-pos     (point))
           (brace-stx     (syntax-after brace-pos))
           (brace-stxcode (car brace-stx)))
      (setq ppss (parse-partial-sexp last-ppss-pos brace-pos nil nil ppss))
      (setq last-ppss-pos brace-pos)
      (forward-char)
      (cond ((conshine-ignore brace-pos ppss brace-stxcode)
             nil)
            ((= 4 (logand #xFFFF brace-stxcode))
             (conshine-colourise brace-pos (1+ (nth 0 ppss)) t))
            (t
             (let ((matches-p (eq (cdr brace-stx) (char-after (nth 1 ppss)))))
               (conshine-colourise brace-pos (nth 0 ppss) matches-p)))))))
1
  • No, that's all. I am refactoring a large code base and could benefit from advice in case I do something dumb without realising.
    – Dilna
    Jul 21, 2022 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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