Path: utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!birdland!rberlin From: rberlin%birdland@Sun.COM (Rich Berlin) Newsgroups: gnu.emacs Subject: Re: A find-file Hack Message-ID: <74562@sun.uucp> Date: 25 Oct 88 20:59:18 GMT References: <8810251636.AA10923@ELI.CS.YALE.EDU> Sender: news@sun.uucp Distribution: gnu Lines: 35 In-reply-to: ram-ashwin@YALE.ARPA's message of 25 Oct 88 16:36:54 GMT To simulate ls -l using file-attributes is certainly possible, but since there doesn't seem to be an elisp-interface to getpwent, you have to search /etc/passwd for the uid number (and punt or do something else ugly if you're using a name server like NFS, where the entry may not be in /etc/passwd....) On my machine (a Sun 3/160, 12MB, running 4.0), using /bin/ls is acceptably fast and a lot easier. But, now I am thinking about trying to support the getpwent function. Opinions (especially from RMS) about the practice of adding interfaces to system calls? It certainly raises the risk of writing system-specific emacs extensions! By the way, I've had other occasions when I wanted the output of a command, so I wrote a function which, rather than applying 'message to the buffer contents, returns them as a string. It's easy to then pass the string to message: (defun results-of-command (command &rest args) "Execute the given COMMAND with &rest ARGS, and return the resulting\n\ output as a string." (let (foo (temp-buffer-show-hook '(lambda (buffer) (set-buffer buffer) (setq foo (buffer-substring (point-min) (1- (point-max)))) (kill-buffer buffer)))) (save-excursion (with-output-to-temp-buffer "*results of command*" (apply 'call-process command nil standard-output nil args)) foo))) -- Rich