Menu

[1da77c]: / cedet-ediff.el  Maximize  Restore  History

Download this file

124 lines (96 with data), 4.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
;;; cedet-ediff --- Ediffing utilities for CEDET maintenance.
;;; Copyright (C) 2008, 2009, 2010 Eric M. Ludlam
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is not part of GNU Emacs.
;; Semantic is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;; M-x cedet-ediff-emacs
;;
;; To compare the current buffer vs a matching buffer in CEDET/Emacs
;; repositories. Set the repository locations to start using this
;; utility to run ediff between repository versions.
;;
;;; Code:
(defvar cedet-ediff-emacs-repository (expand-file-name "~/src/emacs.cedet/lisp")
"Location of the Emacs repository.")
(defvar cedet-ediff-cedet-repository (expand-file-name "~/cedet")
"Location of the Emacs repository.")
(defun cedet-ediff-emacs ()
"Ediff the current buffer to a match in the Emacs repository."
(interactive)
(let ((src (buffer-file-name (current-buffer)))
(destfile nil)
(buff nil))
;; Find a repository match
(cond ((string-match (concat "^" cedet-ediff-cedet-repository) src)
(setq destfile (cedet-repository-map-cedet->emacs src)))
((string-match (concat "^" cedet-ediff-emacs-repository) src)
(setq destfile (cedet-repository-map-emacs->cedet src)))
)
(when (not destfile)
(error "No destination found"))
(setq buff (find-file-noselect destfile))
(ediff-buffers (current-buffer) buff)
))
(defvar cedet-ediff-file-map
'(
;; CEDET regexp . Emacs regexp
("ede/ede-" . "cedet/ede/")
("ede/project-am.el" . "cedet/ede/project-am.el")
("ede/ede\\.el" . "cedet/ede\\.el")
("srecode/srecode-" . "cedet/srecode")
("ede/srecode\\.el" . "cedet/srecode\\.el")
("semantic/semantic-" . "cedet/semantic/")
("semantic/wisent/wisent/wisent.el" . "cedet/semantic/wisent.el")
("semantic/wisent/wisent-" . "cedet/semantic/wisent/")
("semantic/semanticdb-" . "cedet/semantic/db-")
("common/" . "cedet/")
("eieio/" . "emacs-lisp/")
)
"Map files names in the CEDET repository to files in the Emacs repository.")
(defun cedet-repository-map-cedet->emacs (&optional file)
"Map FILE from a CEDET repository name to an Emacs repository name."
(interactive)
(when (not file) (setq file (buffer-file-name (current-buffer))))
(if (not (string-match (concat "^" cedet-ediff-cedet-repository) file))
(error "Not in your cedet repository"))
(setq file (replace-match cedet-ediff-emacs-repository t t file))
(let ((map cedet-ediff-file-map)
ans)
(while (and map (not ans))
(when (string-match (car (car map)) file)
(setq ans (replace-match (cdr (car map)) nil t file))
)
(setq map (cdr map)))
(when (interactive-p) (message "Translation: %S" ans))
ans))
(defun cedet-repository-map-emacs->cedet (&optional file)
"Map FILE from a Emacs repository name to an CEDET repository name."
(interactive)
(when (not file) (setq file (buffer-file-name (current-buffer))))
(if (not (string-match (concat "^" cedet-ediff-emacs-repository) file))
(error "Not in your cedet repository"))
(setq file (replace-match cedet-ediff-cedet-repository t t file))
(let ((map cedet-ediff-file-map)
ans)
(while (and map (not ans))
(when (string-match (cdr (car map)) file)
(setq ans (replace-match (car (car map)) nil t file))
)
(setq map (cdr map)))
(when (interactive-p) (message "Translation: %S" ans))
ans))
(provide 'cedet-ediff)
;;; cedet-ediff.el ends here
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.