unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* kludge in find-file.el
@ 2005-07-02 12:33 Richard M. Stallman
  2005-08-16 15:14 ` Stuart D. Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Richard M. Stallman @ 2005-07-02 12:33 UTC (permalink / raw)


I noticed this because it got a warning.  It seems rather a kludge.
Is there any more general feature that could be used here?

(defun ff-which-function-are-we-in ()
  "Return the name of the function whose definition/declaration point is in.
Also remember that name in `ff-function-name'."

  (setq ff-function-name nil)

  (save-excursion
    (if (re-search-backward ada-procedure-start-regexp nil t)
        (setq ff-function-name (buffer-substring (match-beginning 0)
                                                 (match-end 0)))
      ; we didn't find a procedure start, perhaps there is a package
      (if (re-search-backward ada-package-start-regexp nil t)
          (setq ff-function-name (buffer-substring (match-beginning 0)
                                                   (match-end 0)))
        ))))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: kludge in find-file.el
  2005-07-02 12:33 kludge in find-file.el Richard M. Stallman
@ 2005-08-16 15:14 ` Stuart D. Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Stuart D. Herring @ 2005-08-16 15:14 UTC (permalink / raw)
  Cc: emacs-devel

Reviving a thread from a few weeks ago:

> I noticed this because it got a warning.  It seems rather a kludge.
> Is there any more general feature that could be used here?
>
> (defun ff-which-function-are-we-in ()
>   "Return the name of the function whose definition/declaration point is
> in.
> Also remember that name in `ff-function-name'."
>
>   (setq ff-function-name nil)
>
>   (save-excursion
>     (if (re-search-backward ada-procedure-start-regexp nil t)
>         (setq ff-function-name (buffer-substring (match-beginning 0)
>                                                  (match-end 0)))
>       ; we didn't find a procedure start, perhaps there is a package
>       (if (re-search-backward ada-package-start-regexp nil t)
>           (setq ff-function-name (buffer-substring (match-beginning 0)
>                                                    (match-end 0)))
>         ))))

What exactly is the problem here?  It's an example in find-file.el to
illustrate an extension mechanism it supports.  Is it just that the
function returns a value as well as storing it by side-effect?

Davis Herring

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-16 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-02 12:33 kludge in find-file.el Richard M. Stallman
2005-08-16 15:14 ` Stuart D. Herring

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).