mirror of https://github.com/Chizi123/.emacs.d.git

Joel Grunbaum
2021-12-22 5324d5fcbf8e365dc774795ceeedf1cac9d0b4bb
Added a more general git hook prompt and gerrit compatibality
1 files modified
34 ■■■■■ changed files
config.org 34 ●●●●● patch | view | raw | blame | history
config.org
@@ -917,7 +917,39 @@
       magit-process-popup-time 10
       ;; ask me if I want a tracking upstream
       magit-set-upstream-on-push 'askifnotset
       )))
         ))
      )
#+END_SRC
*** More general yes and no prompt
The default setting can miss some.
Don't redefine the regex in case this is too general.
#+BEGIN_SRC emacs-lisp
  ;;(when-let ((regex "[\[\(]]?\\([Yy]\\(es\\)?\\)[/|]\\([Nn]o?\\)[\]\)]")
  (defun magit-process-general-yn-prompt-hook (proc str)
    "Handle [y/n] prompts"
    (when-let ((beg (string-match "[\[\(]]?\\([Yy]\\(es\\)?\\)[/|]\\([Nn]o?\\)[\]\)]" str)))
      (let ;; ((max-mini-window-height 30))
          (process-send-string
           proc
           (downcase
            (concat
             (match-string
              (if (save-match-data
                    (magit-process-kill-on-abort proc
                                                 (y-or-n-p (substring str 0 beg)))) 1 2)
              str)
             "\n"))))))
  (add-hook 'magit-process-prompt-functions
            #'magit-process-general-yn-prompt-hook)
#+END_SRC
*** Gerrit integration
Gerrit takes ~origin:refs/for/master~ as a destination.
Enable magit to work with its oddities.
#+BEGIN_SRC emacs-lisp
  (use-package magit-gerrit
    :ensure t)
#+END_SRC
** CEDET