Function: srecode-map-update-app-file-entry

srecode-map-update-app-file-entry is a byte-compiled function defined in map.el.gz.

Signature

(srecode-map-update-app-file-entry ARG &rest ARGS)

Implementations

(srecode-map-update-app-file-entry (MAP srecode-map) FILE MODE APP) in `srecode/map.el'.

Update the MAP entry for FILE to be used with MODE within APP. Return non-nil if the map was changed.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/map.el.gz
(cl-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))