.emacs-my
changeset 1550 e3a381f14ad1
parent 1549 4ede173a315f
child 1552 da98a7d4c704
equal deleted inserted replaced
1549:4ede173a315f 1550:e3a381f14ad1
  3491 (add-to-list 'auto-mode-alist '("\.atom\\'" . nxml-mode))
  3491 (add-to-list 'auto-mode-alist '("\.atom\\'" . nxml-mode))
  3492 
  3492 
  3493 (my--eval-after-load nxml-mode
  3493 (my--eval-after-load nxml-mode
  3494   (define-key nxml-mode-map [C-return] 'nxml-complete))
  3494   (define-key nxml-mode-map [C-return] 'nxml-complete))
  3495 
  3495 
       
  3496 (defun my-nxml-where (&optional prefix)
       
  3497   "Display the hierarchy of XML elements the point is on as a path."
       
  3498   (interactive "P")
       
  3499   (let (path)
       
  3500     (save-excursion
       
  3501       (save-restriction
       
  3502         (widen)
       
  3503         (while (and (< (point-min) (point))
       
  3504                     (condition-case nil
       
  3505                         (progn
       
  3506                           (nxml-backward-up-element)
       
  3507                           t)
       
  3508                       (error nil)))
       
  3509           (setq path (cons (xmltok-start-tag-local-name) path)))
       
  3510         (setq path (mapconcat 'identity path "/"))
       
  3511         (when prefix
       
  3512           (kill-new path))
       
  3513         (if (called-interactively-p t)
       
  3514             (message "%s" path)
       
  3515           path)))))
       
  3516 
  3496 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3517 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3497 (message "relax ng, rng")
  3518 (message "relax ng, rng")
  3498 
  3519 
  3499 (my--eval-after-load rng-loc
  3520 (my--eval-after-load rng-loc
  3500   (add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml"))
  3521   (add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml"))