Function: jinx-occur

jinx-occur is an interactive and natively compiled function defined in jinx.el.

Signature

(jinx-occur)

Documentation

Display all lines containing misspelled words in a separate occur-mode buffer.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/b5jnxgwmlp7hh60wfrx7amhrmrpfcqqi-emacs-packages-deps/share/emacs/site-lisp/elpa/jinx-20260926.912/jinx.el
;;;###autoload
(defun jinx-occur ()
  "Display all lines containing misspelled words in a separate `occur-mode' buffer."
  (interactive)
  (let ((buf (get-buffer-create "*jinx-occur*"))
        (where (buffer-name))
        overlays lines)
    (save-excursion
      (jinx--correct-guard
       (goto-char (point-min))
       (setq overlays (jinx--force-overlays (point-min) (point-max)))
       (dolist (ov overlays)
         (goto-char (overlay-start ov))
         (let ((bol (pos-bol))
               (line (line-number-at-pos))
               (ov (cons (copy-overlay ov) (copy-marker (overlay-start ov)))))
           (if (equal (caar lines) line)
               (push ov (nth 3 (car lines)))
             (push `( ,line ,(buffer-substring bol (pos-eol)) ,bol (,ov)) lines))))))
    (with-current-buffer buf
      (with-silent-modifications
        (erase-buffer)
        (insert (format (propertize "%d misspelled words in %d lines in %s" 'face 'underline)
                        (length overlays) (length lines) where)
                ?\n)
        (pcase-dolist (`(,line ,str ,bol ,ovs) (nreverse lines))
          (let ((start (point)))
            (insert
             (format (propertize "%7d:"
                                 'occur-prefix t
                                 'front-sticky t
                                 'rear-nonsticky t
                                 'read-only t
                                 'font-lock-face list-matching-lines-prefix-face)
                     line)
             str ?\n)
            (put-text-property start (1- (point)) 'mouse-face 'highlight)
            (add-text-properties start (point)
                                 `( follow-link t
                                    occur-target ,(cdar (last ovs))
                                    occur-match t))
            (dolist (ov ovs)
              (let ((beg (+ start 8 (- (overlay-start (car ov)) bol)))
                    (end (+ start 8 (- (overlay-end (car ov)) bol))))
                (add-text-properties beg end `(occur-match t occur-target ,(cdr ov)))
                (move-overlay (car ov) beg end buf)))))
        (goto-char (point-min))
        (occur-mode)
        (setq next-error-last-buffer buf)
        (pop-to-buffer buf)))))