<commit_before>;; Load iedit.
(add-to-list 'load-path "~/.emacs.d/lib/iedit")
(require 'iedit)

(defun iedit-dwim (&optional arg)
  "Starts iedit but uses \\[narrow-to-defun] to limit its scope."
  (interactive "P")
  (if arg
      (iedit-mode)
    (save-excursion
      (save-restriction
        (if iedit-mode
            (iedit-done)
          (iedit-mode))))))

;; Bind to M-'.
(global-set-key "\M-'" 'iedit-dwim)<commit_msg>Bind iedit-global to M-" and local to M-'<commit_after>;; Load iedit.
(add-to-list 'load-path "~/.emacs.d/lib/iedit")
(require 'iedit)

(defun iedit-global (&optional arg)
  "Starts iedit but uses \\[narrow-to-region] to limit its scope."
  (interactive "P")
  (if arg
      (iedit-mode)
    (save-excursion
      (save-restriction
        (if iedit-mode
            (iedit-done)
          (iedit-mode))))))

(defun iedit-local (&optional arg)
  "Starts iedit but uses \\[narrow-to-defun] to limit its scope."
  (interactive "P")
  (if arg
      (iedit-mode)
    (save-excursion
      (save-restriction
        (widen)
        ;; Shrink scope.
        (narrow-to-defun)

        (if iedit-mode
            (iedit-done)
          (iedit-mode))))))

;; Bind to M-'.
(global-set-key "\M-'" 'iedit-local)

;; Bind to M-"
(global-set-key "\M-\"" 'iedit-global)
{'fraction_non_alphanumeric': 0.17523364485981308, 'fraction_numerical': 0.0, 'mean_word_length': 2.3118556701030926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2586007', 'n_tokens_mistral': 506, 'n_tokens_neox': 503, 'n_words': 116}