Skip to content
Create a gist now

Instantly share code, notes, and snippets.

(defun c++-type-at (point)
"Use semantic to determine the fully namespace-qualified type of the symbol at POINT."
(interactive "d")
(let* ((ctxt (semantic-analyze-current-context point))
(pf (reverse (oref ctxt prefix)))
(lastname (pop pf))
(tag (if (semantic-tag-p lastname) lastname (car pf)))
(names (append
(when (semantic-tag-p tag)
(when (semantic-tag-with-position-p tag)
(set-buffer (semantic-tag-buffer tag))
(semantic-go-to-tag tag)
(mapcar 'semantic-tag-name (semantic-analyze-scope-nested-tags (point) nil))
(list (if (semantic-tag-p lastname) (semantic-tag-name lastname) lastname))
(message (mapconcat 'concat names "::"))
(defvar c++-doco-sources
'(("std::" . "")
("boost::" . "")
(defun semantic-browse-c++-doc (point)
"Browse the documentation for the C++ symbol at POINT."
(interactive "d")
(let* ((cpptype (c++-type-at point))
(ref (car (cl-member-if (lambda (S) (string-prefix-p (car S) cpptype)) c++-doco-sources))))
(unless ref
(error "No documentation source found for %s" cpptype))
(browse-url (format (cdr ref) cpptype))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.