User Tools

Site Tools


development:emacs:ediff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
development:emacs:ediff [2021/07/12 21:08] Ralf Hoppedevelopment:emacs:ediff [2026/03/29 20:02] (current) Ralf Hoppe
Line 6: Line 6:
 #!/bin/bash #!/bin/bash
 # #
-Copyright (C) 2013-2020 Ralf Hoppe <ralf@dfcgen.de> +Emacs EDIFF shell script
-# +NOTE: This script was tested with bash, dash (Debian 12) and zsh (macOS 26+).
-# ediff.sh+
 # #
 # Usage: ediff.sh [--client] LOCAL REMOTE [MERGED [BASE]] # Usage: ediff.sh [--client] LOCAL REMOTE [MERGED [BASE]]
 +#
 +# Copyright (C) 2013-2026 Ralf Hoppe <ralf@rho62.de>
 # #
  
-function abspath()+abspath ()
 { {
     [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"     [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
Line 19: Line 20:
  
  
-MERGE=1 # if this is a MERGE+# if this is really a MERGE 
 +MERGE=1
  
 if [ $# -gt 0 ] && [ "$1" = "--client" ] ; then if [ $# -gt 0 ] && [ "$1" = "--client" ] ; then
Line 27: Line 29:
     BASE=$(abspath "$5")     BASE=$(abspath "$5")
     EMACS_CMD="emacsclient --create-frame"     EMACS_CMD="emacsclient --create-frame"
 +
     # NOTE: Empty list `vc-handled-backends' is a workaround for Emacs 24     # NOTE: Empty list `vc-handled-backends' is a workaround for Emacs 24
     #       bug #18788, regarding vc-git mode-line.     #       bug #18788, regarding vc-git mode-line.
     ELISP_COMMON=\     ELISP_COMMON=\
-"(setq rho/vc-handled-backends-backup vc-handled-backends                          +"(setq rho/vc-handled-backends-backup vc-handled-backends      
-       rho/ediff-frame (selected-frame)                                            +       rho/sh-ediff-buf-local (get-file-buffer \"${LOCAL}\"  \ 
-       cscope-initial-directory nil                                                +       rho/sh-ediff-buf-remote (get-file-buffer \"${REMOTE}\") \ 
-       vc-handled-backends ())                                                     +       rho/sh-ediff-frame (selected-frame)                     
- (defun rho/ediff-quit-hook-external ()                                            +       cscope-initial-directory nil                            
-     (setq vc-handled-backends rho/vc-handled-backends-backup)                     +       vc-handled-backends ())                                 
-     (remove-hook 'ediff-quit-hook 'rho/ediff-quit-hook-external                 + (defun rho/sh-ediff-quit-hook ()                              
-     (delete-frame rho/ediff-frame))                                               +     (setq vc-handled-backends rho/vc-handled-backends-backup) 
- (add-hook 'ediff-quit-hook 'rho/ediff-quit-hook-external t)"+     (ignore-errors                                            \ 
 +         (unless rho/sh-ediff-buf-local                        \ 
 +             (kill-buffer (get-file-buffer \"${LOCAL}\")))     \ 
 +         (unless rho/sh-ediff-buf-remote                       \ 
 +             (kill-buffer (get-file-buffer \"${REMOTE}\"))))   
 +     (remove-hook 'ediff-quit-hook 'rho/sh-ediff-quit-hook)    
 +     (when (frame-live-p rho/sh-ediff-frame)                   \ 
 +         (delete-frame rho/sh-ediff-frame)))                   
 + (add-hook 'ediff-quit-hook 'rho/sh-ediff-quit-hook t)"
  
-    if [ -z "$(lsof -u $USER -a -c emacs 2>/dev/null | grep -w server)" ] ; then +    if [ -z "$(lsof -u $USER -a -c '/[Ee]macs/' 2>/dev/null | grep '/server')" ] ; then 
-        emacs --rho-minimal --no-site-file +        emacs --rho-minimal & 
-        sleep 3+        sleep 2
     fi     fi
  
Line 52: Line 63:
     MERGED=$(abspath "$3")     MERGED=$(abspath "$3")
     BASE=$(abspath "$4")     BASE=$(abspath "$4")
-    EMACS_CMD="emacs --rho-minimal --no-site-file"+    EMACS_CMD="emacs --rho-minimal"
     ELISP_COMMON=\     ELISP_COMMON=\
 "(setq ediff-quit-hook 'kill-emacs \ "(setq ediff-quit-hook 'kill-emacs \
development/emacs/ediff.txt · Last modified: by Ralf Hoppe