2009-09-20 21:06:41 +00:00
|
|
|
|
;;; srecode/map.el --- Manage a template file map
|
|
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
|
;; Copyright (C) 2008-2014 Free Software Foundation, Inc.
|
2009-09-20 21:06:41 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Eric M. Ludlam <eric@siege-engine.com>
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs 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 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; Read template files, and build a map of where they can be found.
|
|
|
|
|
;; Save the map to disk, and refer to it when bootstrapping a new
|
|
|
|
|
;; Emacs session with srecode.
|
|
|
|
|
|
|
|
|
|
(require 'semantic)
|
|
|
|
|
(require 'eieio-base)
|
|
|
|
|
(require 'srecode)
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
;; The defcustom is given at the end of the file.
|
|
|
|
|
(defvar srecode-map-load-path)
|
|
|
|
|
|
|
|
|
|
(defun srecode-map-base-template-dir ()
|
|
|
|
|
"Find the base template directory for SRecode."
|
2009-10-03 19:28:05 +00:00
|
|
|
|
(expand-file-name "srecode" data-directory))
|
2009-09-20 21:06:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Current MAP
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(defvar srecode-current-map nil
|
2009-10-01 03:08:03 +00:00
|
|
|
|
"The current map for global SRecode templates.")
|
2009-09-20 21:06:41 +00:00
|
|
|
|
|
2009-10-03 20:38:30 +00:00
|
|
|
|
(defcustom srecode-map-save-file
|
2009-10-04 01:03:51 +00:00
|
|
|
|
(locate-user-emacs-file "srecode-map.el" ".srecode/srecode-map")
|
2009-09-20 21:06:41 +00:00
|
|
|
|
"The save location for SRecode's map file.
|
|
|
|
|
If the save file is nil, then the MAP is not saved between sessions."
|
|
|
|
|
:group 'srecode
|
|
|
|
|
:type 'file)
|
|
|
|
|
|
|
|
|
|
(defclass srecode-map (eieio-persistent)
|
|
|
|
|
((fileheaderline :initform ";; SRECODE TEMPLATE MAP")
|
|
|
|
|
(files :initarg :files
|
|
|
|
|
:initform nil
|
|
|
|
|
:type list
|
|
|
|
|
:documentation
|
|
|
|
|
"An alist of files and the major-mode that they cover.")
|
|
|
|
|
(apps :initarg :apps
|
|
|
|
|
:initform nil
|
|
|
|
|
:type list
|
|
|
|
|
:documentation
|
|
|
|
|
"An alist of applications.
|
|
|
|
|
Each app keys to an alist of files and modes (as above.)")
|
|
|
|
|
)
|
|
|
|
|
"A map of srecode templates.")
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-entry-for-file ((map srecode-map) file)
|
|
|
|
|
"Return the entry in MAP for FILE."
|
|
|
|
|
(assoc file (oref map files)))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-entries-for-mode ((map srecode-map) mode)
|
|
|
|
|
"Return the entries in MAP for major MODE."
|
|
|
|
|
(let ((ans nil))
|
|
|
|
|
(dolist (f (oref map files))
|
|
|
|
|
(when (mode-local-use-bindings-p mode (cdr f))
|
|
|
|
|
(setq ans (cons f ans))))
|
|
|
|
|
ans))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-entry-for-app ((map srecode-map) app)
|
|
|
|
|
"Return the entry in MAP for APP'lication."
|
|
|
|
|
(assoc app (oref map apps))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-entries-for-app-and-mode ((map srecode-map) app mode)
|
|
|
|
|
"Return the entries in MAP for major MODE."
|
|
|
|
|
(let ((ans nil)
|
|
|
|
|
(appentry (srecode-map-entry-for-app map app)))
|
|
|
|
|
(dolist (f (cdr appentry))
|
|
|
|
|
(when (eq (cdr f) mode)
|
|
|
|
|
(setq ans (cons f ans))))
|
|
|
|
|
ans))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-entry-for-file-anywhere ((map srecode-map) file)
|
|
|
|
|
"Search in all entry points in MAP for FILE.
|
|
|
|
|
Return a list ( APP . FILE-ASSOC ) where APP is nil
|
|
|
|
|
in the global map."
|
|
|
|
|
(or
|
|
|
|
|
;; Look in the global entry
|
|
|
|
|
(let ((globalentry (srecode-map-entry-for-file map file)))
|
|
|
|
|
(when globalentry
|
|
|
|
|
(cons nil globalentry)))
|
|
|
|
|
;; Look in each app.
|
|
|
|
|
(let ((match nil))
|
|
|
|
|
(dolist (app (oref map apps))
|
|
|
|
|
(let ((appmatch (assoc file (cdr app))))
|
|
|
|
|
(when appmatch
|
|
|
|
|
(setq match (cons app appmatch)))))
|
|
|
|
|
match)
|
|
|
|
|
;; Other?
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-delete-file-entry ((map srecode-map) file)
|
|
|
|
|
"Update MAP to exclude FILE from the file list."
|
|
|
|
|
(let ((entry (srecode-map-entry-for-file map file)))
|
|
|
|
|
(when entry
|
|
|
|
|
(object-remove-from-list map 'files entry))))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-update-file-entry ((map srecode-map) file mode)
|
|
|
|
|
"Update a MAP entry for FILE to be used with MODE.
|
|
|
|
|
Return non-nil if the MAP was changed."
|
|
|
|
|
(let ((entry (srecode-map-entry-for-file map file))
|
|
|
|
|
(dirty t))
|
|
|
|
|
(cond
|
|
|
|
|
;; It is already a match.. do nothing.
|
|
|
|
|
((and entry (eq (cdr entry) mode))
|
|
|
|
|
(setq dirty nil))
|
|
|
|
|
;; We have a non-matching entry. Change the cdr.
|
|
|
|
|
(entry
|
|
|
|
|
(setcdr entry mode))
|
|
|
|
|
;; No entry, just add it to the list.
|
|
|
|
|
(t
|
|
|
|
|
(object-add-to-list map 'files (cons file mode))
|
|
|
|
|
))
|
|
|
|
|
dirty))
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-delete-file-entry-from-app ((map srecode-map) file app)
|
|
|
|
|
"Delete from MAP the FILE entry within the APP'lication."
|
|
|
|
|
(let* ((appe (srecode-map-entry-for-app map app))
|
|
|
|
|
(fentry (assoc file (cdr appe))))
|
|
|
|
|
(setcdr appe (delete fentry (cdr appe))))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod srecode-map-update-app-file-entry ((map srecode-map) file mode app)
|
|
|
|
|
"Update the MAP entry for FILE to be used with MODE within APP.
|
|
|
|
|
Return non-nil if the map was changed."
|
|
|
|
|
(let* ((appentry (srecode-map-entry-for-app map app))
|
|
|
|
|
(appfileentry (assoc file (cdr appentry)))
|
|
|
|
|
(dirty t)
|
|
|
|
|
)
|
|
|
|
|
(cond
|
|
|
|
|
;; Option 1 - We have this file in this application already
|
|
|
|
|
;; with the correct mode.
|
|
|
|
|
((and appfileentry (eq (cdr appfileentry) mode))
|
|
|
|
|
(setq dirty nil)
|
|
|
|
|
)
|
|
|
|
|
;; Option 2 - We have a non-matching entry. Change Cdr.
|
|
|
|
|
(appfileentry
|
|
|
|
|
(setcdr appfileentry mode))
|
|
|
|
|
(t
|
|
|
|
|
;; For option 3 & 4 - remove the entry from any other lists
|
|
|
|
|
;; we can find.
|
|
|
|
|
(let ((any (srecode-map-entry-for-file-anywhere map file)))
|
|
|
|
|
(when any
|
|
|
|
|
(if (null (car any))
|
|
|
|
|
;; Global map entry
|
|
|
|
|
(srecode-map-delete-file-entry map file)
|
|
|
|
|
;; Some app
|
|
|
|
|
(let ((appentry (srecode-map-entry-for-app map app)))
|
|
|
|
|
(setcdr appentry (delete (cdr any) (cdr appentry))))
|
|
|
|
|
)))
|
|
|
|
|
;; Now do option 3 and 4
|
|
|
|
|
(cond
|
|
|
|
|
;; Option 3 - No entry for app. Add to the list.
|
|
|
|
|
(appentry
|
|
|
|
|
(setcdr appentry (cons (cons file mode) (cdr appentry)))
|
|
|
|
|
)
|
|
|
|
|
;; Option 4 - No app entry. Add app to list with this file.
|
|
|
|
|
(t
|
|
|
|
|
(object-add-to-list map 'apps (list app (cons file mode)))
|
|
|
|
|
)))
|
|
|
|
|
)
|
|
|
|
|
dirty))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; MAP Updating
|
|
|
|
|
;;
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun srecode-get-maps (&optional reset)
|
|
|
|
|
"Get a list of maps relevant to the current buffer.
|
|
|
|
|
Optional argument RESET forces a reset of the current map."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
;; Always update the map, but only do a full reset if
|
|
|
|
|
;; the user asks for one.
|
|
|
|
|
(srecode-map-update-map (not reset))
|
|
|
|
|
|
2009-11-22 23:49:13 +00:00
|
|
|
|
(if (called-interactively-p 'any)
|
2009-09-20 21:06:41 +00:00
|
|
|
|
;; Dump this map.
|
|
|
|
|
(with-output-to-temp-buffer "*SRECODE MAP*"
|
|
|
|
|
(princ " -- SRecode Global map --\n")
|
|
|
|
|
(srecode-maps-dump-file-list (oref srecode-current-map files))
|
|
|
|
|
(princ "\n -- Application Maps --\n")
|
|
|
|
|
(dolist (ap (oref srecode-current-map apps))
|
|
|
|
|
(let ((app (car ap))
|
|
|
|
|
(files (cdr ap)))
|
|
|
|
|
(princ app)
|
|
|
|
|
(princ " :\n")
|
|
|
|
|
(srecode-maps-dump-file-list files))
|
|
|
|
|
(princ "\n"))
|
|
|
|
|
(princ "\nUse:\n\n M-x customize-variable RET srecode-map-load-path RET")
|
|
|
|
|
(princ "\n To change the path where SRecode loads templates from.")
|
|
|
|
|
)
|
|
|
|
|
;; Eventually, I want to return many maps to search through.
|
|
|
|
|
(list srecode-current-map)))
|
|
|
|
|
|
2012-10-25 22:13:16 +02:00
|
|
|
|
(declare-function data-debug-new-buffer "data-debug")
|
|
|
|
|
(declare-function data-debug-insert-stuff-list "data-debug")
|
2009-09-20 21:06:41 +00:00
|
|
|
|
|
|
|
|
|
(defun srecode-adebug-maps ()
|
|
|
|
|
"Run ADEBUG on the output of `srecode-get-maps'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(require 'data-debug)
|
|
|
|
|
(let ((start (current-time))
|
|
|
|
|
(p (srecode-get-maps t)) ;; Time the reset.
|
|
|
|
|
(end (current-time))
|
|
|
|
|
)
|
|
|
|
|
(message "Updating the map took %.2f seconds."
|
|
|
|
|
(semantic-elapsed-time start end))
|
|
|
|
|
(data-debug-new-buffer "*SRECODE ADEBUG*")
|
|
|
|
|
(data-debug-insert-stuff-list p "*")))
|
|
|
|
|
|
|
|
|
|
(defun srecode-maps-dump-file-list (flist)
|
|
|
|
|
"Dump a file list FLIST to `standard-output'."
|
|
|
|
|
(princ "Mode\t\t\tFilename\n")
|
|
|
|
|
(princ "------\t\t\t------------------\n")
|
|
|
|
|
(dolist (fe flist)
|
|
|
|
|
(prin1 (cdr fe))
|
|
|
|
|
(princ "\t")
|
|
|
|
|
(when (> (* 2 8) (length (symbol-name (cdr fe))))
|
|
|
|
|
(princ "\t"))
|
|
|
|
|
(when (> 8 (length (symbol-name (cdr fe))))
|
|
|
|
|
(princ "\t"))
|
|
|
|
|
(princ (car fe))
|
|
|
|
|
(princ "\n")
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defun srecode-map-file-still-valid-p (filename map)
|
|
|
|
|
"Return t if FILENAME should be in MAP still."
|
|
|
|
|
(let ((valid nil))
|
|
|
|
|
(and (file-exists-p filename)
|
|
|
|
|
(progn
|
|
|
|
|
(dolist (p srecode-map-load-path)
|
|
|
|
|
(when (and (< (length p) (length filename))
|
|
|
|
|
(string= p (substring filename 0 (length p))))
|
|
|
|
|
(setq valid t))
|
|
|
|
|
)
|
|
|
|
|
valid))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defun srecode-map-update-map (&optional fast)
|
|
|
|
|
"Update the current map from `srecode-map-load-path'.
|
|
|
|
|
Scans all the files on the path, and makes sure we have entries
|
|
|
|
|
for them.
|
|
|
|
|
If option FAST is non-nil, then only parse a file for the mode-string
|
|
|
|
|
if that file is NEW, otherwise assume the mode has not changed."
|
|
|
|
|
(interactive)
|
|
|
|
|
|
|
|
|
|
;; When no map file, we are configured to not use a save file.
|
|
|
|
|
(if (not srecode-map-save-file)
|
|
|
|
|
;; 0) Create a MAP when in no save file mode.
|
|
|
|
|
(when (not srecode-current-map)
|
|
|
|
|
(setq srecode-current-map (srecode-map "SRecode Map"))
|
|
|
|
|
(message "SRecode map created in non-save mode.")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; 1) Do we even have a MAP or save file?
|
|
|
|
|
(when (and (not srecode-current-map)
|
|
|
|
|
(not (file-exists-p srecode-map-save-file)))
|
|
|
|
|
(when (not (file-exists-p (file-name-directory srecode-map-save-file)))
|
|
|
|
|
;; Only bother with this interactively, not during a build
|
|
|
|
|
;; or test.
|
|
|
|
|
(when (not noninteractive)
|
|
|
|
|
;; No map, make the dir?
|
|
|
|
|
(if (y-or-n-p (format "Create dir %s? "
|
|
|
|
|
(file-name-directory srecode-map-save-file)))
|
|
|
|
|
(make-directory (file-name-directory srecode-map-save-file))
|
|
|
|
|
;; No make, change save file
|
|
|
|
|
(customize-variable 'srecode-map-save-file)
|
|
|
|
|
(error "Change your SRecode map file"))))
|
|
|
|
|
;; Have a dir. Make the object.
|
|
|
|
|
(setq srecode-current-map
|
|
|
|
|
(srecode-map "SRecode Map"
|
|
|
|
|
:file srecode-map-save-file)))
|
|
|
|
|
|
|
|
|
|
;; 2) Do we not have a current map? If so load.
|
|
|
|
|
(when (not srecode-current-map)
|
2010-09-21 18:11:23 -04:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(setq srecode-current-map
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(eieio-persistent-read srecode-map-save-file srecode-map))
|
2010-09-21 18:11:23 -04:00
|
|
|
|
(error
|
|
|
|
|
;; There was an error loading the old map. Create a new one.
|
|
|
|
|
(setq srecode-current-map
|
|
|
|
|
(srecode-map "SRecode Map"
|
|
|
|
|
:file srecode-map-save-file))))
|
2009-09-20 21:06:41 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; We better have a MAP object now.
|
|
|
|
|
;;
|
|
|
|
|
(let ((dirty nil))
|
|
|
|
|
;; 3) - Purge dead files from the file list.
|
|
|
|
|
(dolist (entry (copy-sequence (oref srecode-current-map files)))
|
|
|
|
|
(when (not (srecode-map-file-still-valid-p
|
|
|
|
|
(car entry) srecode-current-map))
|
|
|
|
|
(srecode-map-delete-file-entry srecode-current-map (car entry))
|
|
|
|
|
(setq dirty t)
|
|
|
|
|
))
|
|
|
|
|
(dolist (app (copy-sequence (oref srecode-current-map apps)))
|
|
|
|
|
(dolist (entry (copy-sequence (cdr app)))
|
|
|
|
|
(when (not (srecode-map-file-still-valid-p
|
|
|
|
|
(car entry) srecode-current-map))
|
|
|
|
|
(srecode-map-delete-file-entry-from-app
|
|
|
|
|
srecode-current-map (car entry) (car app))
|
|
|
|
|
(setq dirty t)
|
|
|
|
|
)))
|
|
|
|
|
;; 4) - Find new files and add them to the map.
|
|
|
|
|
(dolist (dir srecode-map-load-path)
|
|
|
|
|
(when (file-exists-p dir)
|
|
|
|
|
(dolist (f (directory-files dir t "\\.srt$"))
|
|
|
|
|
(when (and (not (backup-file-name-p f))
|
|
|
|
|
(not (auto-save-file-name-p f))
|
|
|
|
|
(file-readable-p f))
|
|
|
|
|
(let ((fdirty (srecode-map-validate-file-for-mode f fast)))
|
|
|
|
|
(setq dirty (or dirty fdirty))))
|
|
|
|
|
)))
|
|
|
|
|
;; Only do the save if we are dirty, or if we are in an interactive
|
|
|
|
|
;; Emacs.
|
|
|
|
|
(when (and dirty (not noninteractive)
|
|
|
|
|
(slot-boundp srecode-current-map :file))
|
|
|
|
|
(eieio-persistent-save srecode-current-map))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defun srecode-map-validate-file-for-mode (file fast)
|
|
|
|
|
"Read and validate FILE via the parser. Return the mode.
|
|
|
|
|
Argument FAST implies that the file should not be reparsed if there
|
|
|
|
|
is already an entry for it.
|
|
|
|
|
Return non-nil if the map changed."
|
|
|
|
|
(when (or (not fast)
|
|
|
|
|
(not (srecode-map-entry-for-file-anywhere srecode-current-map file)))
|
|
|
|
|
(let ((buff-orig (get-file-buffer file))
|
|
|
|
|
(dirty nil))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if buff-orig
|
|
|
|
|
(set-buffer buff-orig)
|
|
|
|
|
(set-buffer (get-buffer-create " *srecode-map-tmp*"))
|
|
|
|
|
(insert-file-contents file nil nil nil t)
|
|
|
|
|
;; Force it to be ready to parse.
|
|
|
|
|
(srecode-template-mode)
|
2009-09-26 17:47:11 +00:00
|
|
|
|
(let ((semantic-init-hook nil))
|
2009-09-20 21:06:41 +00:00
|
|
|
|
(semantic-new-buffer-fcn))
|
|
|
|
|
)
|
Merge with CEDET upstream (rev. 8499).
lisp/
* eieio/eieio-datadebug.el (data-debug/eieio-insert-slots):
Inhibit read only while inserting objects.
lisp/cedet/
* semantic.el (navigate-menu): Yank Tag :enable. Make sure
`senator-tag-ring' is bound.
(semantic-parse-region-default): Stop reversing the output of
parse-whole-stream.
(semantic-repeat-parse-whole-stream): Append returned tags
differently, so they come out in the right order.
* semantic/sb.el (semantic-sb-filter-tags-of-class): New option.
(semantic-sb-fetch-tag-table): Filter tags being bucketed to exclude
tags belonging to above filtered classes.
* semantic/find.el (semantic-filter-tags-by-class): New function.
* semantic/tag-ls.el (semantic-tag-similar-p-default): Add
short-circuit in case tag1 and 2 are identical.
* semantic/analyze/fcn.el
(semantic-analyze-dereference-metatype-stack): Use
`semantic-tag-similar-p' instead of 'eq' when comparing two tags
during metatype evaluation in case they are the same, but not the same
node. (Tweaked patch from Tomasz Gajewski) (Tiny change)
* semantic/db-find.el (semanticdb-partial-synchronize): Fix require to
semantic/db-typecache to be correct.
(semanticdb-find-tags-external-children-of-type): Make this a brutish
search by default.
* semantic/sort.el (semantic-tag-external-member-children-default):
When calling `semanticdb-find-tags-external-children-of-type', pass in
the input tag as the place to start searching for externally defined
methods.
* semantic/db-file.el (semanticdb-default-save-directory): Doc
fix: Add ref to default value.
* semantic/complete.el (semantic-complete-post-command-hook): When
detecting if cursor is outside completion area, do so if cursor moves
before start of overlay, or the original starting location of the
overlay (i.e., if user deletes past beginning of the overlay region).
(semantic-complete-inline-tag-engine): Initialize original start of
`semantic-complete-inline-overlay'.
* semantic/bovine/c.el (semantic-c-describe-environment): Update some
section titles. Test semanticdb table before printing it.
(semantic-c-reset-preprocessor-symbol-map): Update
`semantic-lex-spp-macro-symbol-obarray' outside the loop over all the
files contributing to its value.
(semantic-c-describe-environment): If there is an EDE project but no
spp symbols from it, say so.
* srecode/args.el (srecode-semantic-handle-:project): New argument
handler. Provide variable values if not in an EDE project.
* srecode/srt-mode.el (srecode-template-mode): Fix typo on srecode
name.
* srecode/cpp.el (srecode-semantic-handle-:c): Replace all characters
in FILENAME_SYMBOL that aren't valid CPP symbol chars.
* srecode/map.el (srecode-map-validate-file-for-mode): Force semantic
to load if it is not active in the template being added to the map.
* srecode/srt.el: Add local variables for setting the autoload file
name.
(srecode-semantic-handle-:srt): New autoload cookie
* ede.el (ede-apply-preprocessor-map): Apply map to
`semantic-lex-spp-project-macro-symbol-obarray' instead of the system
one. Add require for semantic.
* ede/proj-elisp.el (ede-update-version-in-source): In case a file has
both a version variable and a Version: comment, always use
`call-next-method'.
* ede/cpp-root.el (ede-set-project-variables): Deleted.
`ede-preprocessor-map' does the job this function was attempting to do
with :spp-table.
(ede-preprocessor-map): Update file tests to provide better messages.
Do not try to get symbols from a file that is the file in the current
buffer.
* ede/base.el (ede-project-placeholder): Add more documentation to
:file slot.
(ede-load-cache): Use `insert-file-contents' instead of
`find-file-noselect' in order to avoid activating other tools.
* semantic/bovine/c.el (semantic-get-local-variables): Also add a new
variable 'this' if we are in an inline member function. For detecting
this, we check overlays at point if there is a class spanning the
current function. Also, the variable 'this' has to be a pointer.
* semantic/bovine/gcc.el (semantic-gcc-setup): Fail gracefully when
querying g++ for defines returns an error.
* srecode/srt-mode.el:
* srecode/compile.el:
* semantic/elp.el:
* semantic/db-el.el:
* semantic/complete.el:
* ede.el:
* cogre.el:
* srecode/table.el:
* srecode/mode.el:
* srecode/insert.el:
* srecode/compile.el:
* semantic/decorate/include.el:
* semantic/db.el:
* semantic/adebug.el:
* ede/auto.el:
* srecode/dictionary.el:
* semantic/ede-grammar.el:
* semantic/db.el:
* semantic/db-find.el:
* semantic/db-file.el:
* semantic/complete.el:
* semantic/bovine/c.el:
* semantic/analyze.el:
* ede/util.el:
* ede/proj.el:
* ede/proj-elisp.el:
* ede/pconf.el:
* ede/locate.el:
* ede.el: Adapt to EIEIO namespace cleanup: Rename `object-name' to
`eieio-object-name', `object-set-name-string' to
`eieio-object-set-name-string', `object-class' to
`eieio-object-class', `class-parent' to `eieio-class-parent',
`class-parents' to `eieio-class-parents', `class-children' to
`eieio-class-children', `object-name-string' to
`eieio-object-name-string', `object-class-fast' to
`eieio--object-class'. Also replace direct access with new accessor
functions.
* ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix EDE
file symbol to match rename. Fix ede-cpp-root symbol to include
-project in name.
* cedet-files.el (cedet-files-list-recursively): New function.
Recursively find files whose names are matching to given regex
* ede.el (ede-current-project): Rewrite to avoid imperative style.
* ede/files.el (ede-find-file): Simplify code.
* ede/base.el (ede-normalize-file/directory): Add function to
normalize :file or :directory slots if they are missing.
* ede/cpp-root.el (ede-cpp-root-project): Add compile-command slot.
(project-compile-project): Compiles project using value specified in
:compule-command slot or in compile-command local variable. Value of
slot or local variable could be string or function that receives
project and should return string that will be invoked as command.
(project-compile-target): Invokes compilation of whole project
* ede/files.el (ede-find-project-root): New function to find root of
project that contains specific file.
(ede-files-find-existing): New function which checks presence of given
directory in the list of registered projects.
etc/
* srecode/ede-autoconf.srt: Change Copyright to FSF.
(ede-empty): Change AC_INIT to use PROJECT_NAME, and PROJECT_VERSION.
* srecode/ede-make.srt (ede-empty): Add a dependency on :project. Add
header comment specifying the project's relative path.
* srecode/c.srt (header_guard): Upcase the filename symbol.
* srecode/java.srt (empty-main): New.
(class-tag): Decapitalize class.
2013-03-21 23:11:03 +01:00
|
|
|
|
;; Force semantic to be enabled in this buffer.
|
|
|
|
|
(unless (semantic-active-p)
|
|
|
|
|
(semantic-new-buffer-fcn))
|
2009-09-20 21:06:41 +00:00
|
|
|
|
|
|
|
|
|
(semantic-fetch-tags)
|
|
|
|
|
(let* ((mode-tag
|
|
|
|
|
(semantic-find-first-tag-by-name "mode" (current-buffer)))
|
|
|
|
|
(val nil)
|
|
|
|
|
(app-tag
|
|
|
|
|
(semantic-find-first-tag-by-name "application" (current-buffer)))
|
|
|
|
|
(app nil))
|
|
|
|
|
(if mode-tag
|
|
|
|
|
(setq val (car (semantic-tag-variable-default mode-tag)))
|
|
|
|
|
(error "There should be a mode declaration in %s" file))
|
|
|
|
|
(when app-tag
|
|
|
|
|
(setq app (car (semantic-tag-variable-default app-tag))))
|
|
|
|
|
|
|
|
|
|
(setq dirty
|
|
|
|
|
(if app
|
|
|
|
|
(srecode-map-update-app-file-entry srecode-current-map
|
|
|
|
|
file
|
|
|
|
|
(read val)
|
|
|
|
|
(read app))
|
|
|
|
|
(srecode-map-update-file-entry srecode-current-map
|
|
|
|
|
file
|
|
|
|
|
(read val))))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
dirty)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; THE PATH
|
|
|
|
|
;;
|
|
|
|
|
;; We need to do this last since the setter needs the above code.
|
|
|
|
|
|
|
|
|
|
(defun srecode-map-load-path-set (sym val)
|
|
|
|
|
"Set SYM to the new VAL, then update the srecode map."
|
|
|
|
|
(set-default sym val)
|
|
|
|
|
(srecode-map-update-map t))
|
|
|
|
|
|
|
|
|
|
(defcustom srecode-map-load-path
|
|
|
|
|
(list (srecode-map-base-template-dir)
|
|
|
|
|
(expand-file-name "~/.srecode/")
|
|
|
|
|
)
|
2009-10-03 19:28:05 +00:00
|
|
|
|
"Global load path for SRecode template files."
|
2009-09-20 21:06:41 +00:00
|
|
|
|
:group 'srecode
|
|
|
|
|
:type '(repeat file)
|
|
|
|
|
:set 'srecode-map-load-path-set)
|
|
|
|
|
|
|
|
|
|
(provide 'srecode/map)
|
|
|
|
|
|
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "loaddefs.el"
|
|
|
|
|
;; generated-autoload-load-name: "srecode/map"
|
|
|
|
|
;; End:
|
|
|
|
|
|
|
|
|
|
;;; srecode/map.el ends here
|