Function: smart-c-include-file

smart-c-include-file is a byte-compiled function defined in hmouse-tag.el.

Signature

(smart-c-include-file)

Documentation

If point is on an include file line, try to display file.

Returns non-nil iff on an include file line, even if file is not found. Look for include file in smart-c-cpp-include-path and in directory list smart-c-include-path.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-tag.el
(defun smart-c-include-file ()
  "If point is on an include file line, try to display file.
Returns non-nil iff on an include file line, even if file is not found.
Look for include file in `smart-c-cpp-include-path' and in directory list
`smart-c-include-path'."
  (let ((opoint (point)))
    (beginning-of-line)
    (if (looking-at smart-c-include-regexp)
	(let ((incl-type (string-to-char
			  (buffer-substring-no-properties (match-beginning 2)
							  (1+ (match-beginning 2)))))
	      (file (buffer-substring-no-properties (match-beginning 3) (match-end 3)))
	      (path)
	      (dir-list smart-c-include-path)
	      (found))
	  (goto-char opoint)
	  (setq dir-list (if (eq incl-type ?<)
			     (append dir-list smart-c-cpp-include-path)
			   (cons (file-name-directory (hypb:buffer-file-name))
				 dir-list)))
	  (while dir-list
	    (setq path (expand-file-name file (car dir-list))
		  dir-list (if (setq found (file-exists-p path))
			       nil
			     (cdr dir-list))))
	  ;;
	  ;; If found, display file
	  ;;
	  (if found
	      (if (and (file-readable-p path)
		       (progn
			 (hpath:find path)
			 (or (require 'cc-mode nil t)
			     (progn (beep)
				    (message "(smart-c-include-file):  c-mode undefined")
				    nil))))
		  (smart-cc-mode-initialize)
		(beep)
		(message "(smart-c-include-file):  `%s' unreadable" path))
	    (beep)
	    (message "(smart-c-include-file):  `%s' not found" file))
	  path)
      (goto-char opoint)
      nil)))