Function: smart-c

smart-c is an interactive and byte-compiled function defined in hmouse-tag.el.

Signature

(smart-c &optional IDENTIFIER NEXT LIST-OF-TAGS-TABLES)

Documentation

Jump to the definition of optional C IDENTIFIER or the one at point.

Optional second arg NEXT means jump to next matching C tag.

It assumes that its caller has already checked that the key was pressed in an appropriate buffer and has moved the cursor to the selected buffer.

If:
 (1) on a #include statement, the include file is displayed;
     Look for include file in directory lists smart-c-cpp-include-path
     and smart-c-include-path;
 (2) on a C identifier, the identifier definition is displayed,
     assuming the identifier is found within an etags generated tag file
     in the current directory or any of its ancestor directories;
 (3) if smart-c-use-lib-man is non-nil, the C identifier is
     recognized as a library symbol, and a man page is found for the
     identifier, then the man page is displayed.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-tag.el
(defun smart-c (&optional identifier next list-of-tags-tables)
  "Jump to the definition of optional C IDENTIFIER or the one at point.
Optional second arg NEXT means jump to next matching C tag.

It assumes that its caller has already checked that the key was pressed in an
appropriate buffer and has moved the cursor to the selected buffer.

If:
 (1) on a `#include' statement, the include file is displayed;
     Look for include file in directory lists `smart-c-cpp-include-path'
     and `smart-c-include-path';
 (2) on a C identifier, the identifier definition is displayed,
     assuming the identifier is found within an `etags' generated tag file
     in the current directory or any of its ancestor directories;
 (3) if `smart-c-use-lib-man' is non-nil, the C identifier is
     recognized as a library symbol, and a man page is found for the
     identifier, then the man page is displayed."

  (interactive)
  (or (if identifier nil (smart-c-include-file))
      (let ((tag (or identifier (smart-c-at-tag-p t))))
	;; (message "Looking for `%s'..." tag)
	(condition-case ()
	    (progn
	      (smart-tags-display tag next list-of-tags-tables)
	      ;; (message "Found definition for `%s'" tag)
	      t)
	  (error
	   (if (or (not smart-c-use-lib-man)
		   (not (file-readable-p "~/.CLIBS-LIST")))
	       (progn (message "(smart-c): `%s' definition not found in identifier lookup/tag tables" tag)
		      (beep))
	     (message "Checking if `%s' is a C library function..." tag)
	     (if (smart-library-symbol tag)
		 (progn (message "Displaying C library man page for `%s'" tag)
			(manual-entry tag))
	       (message "(smart-c): `%s' definition not found in identifier lookup/tag tables or C libraries" tag)
	       (beep))))))))