Re: [Mac-emacs-users] Is anybody out there?
Brought to you by:
akochoi
|
From: Andrew C. <ak...@i-...> - 2001-07-04 12:33:04
|
Hi Robert,
I'll try to answer your questions.
> Question #1:
> When I execute Mx-find-grep-dired I get a prompt for the directory
> to search which is correct, then after entering a RegExp pattern it
> comes back with an empty list, the command it executed at the top
> and a message in the mini-buffer that says "Symbol's function
> definition is void: start-process" I tried this on the OS X box I
> have and it works fine. Is there something I need to do first
> before this executes successfully?
Some Emacs commands invoke external Unix programs to help them provide
their functionalities. Find-grep-dired is such a command; it calls
`find'. The Mac port does not support calling an external program
asynchronously (using the Emacs Lisp function start-process). It also
does not have an implementation of `find'.
> Question #2:
> When I try to print with Mx-print-buffer it comes back with a
> message that says "Searching for program: unknown error (100), pr" I
> can't use the normal print from the file menu since it doesn't have
> one. Is there a way to print?
Although the Mac port can call an external program synchronously
(using the Emacs Lisp function call-process), it does not contain an
implementation of `pr', the Unix command for printing a file.
> Question #3:
> I have situations where I am editing XML code and there will be a number of
> elements defined for a particular item in the code.
> For example:
> <user_data>
> <u_item no="1">
> <user item stuff>...
> </u_item no>
>
> <u_item no="2">
> <user item stuff>...
> </u_item no>
> </user_data>
>
> I was trying to find a way to build a macro that would use a variable to
> contain a counter that incremented every time it found a pattern like
> <u_item no="?"> and assign it a number in between the double quotes. The
> reason for this is I may have 15 of these u_item tags and decide I need to
> insert another one at element #2. I would like a to give the macro a
> pattern to search for and allow it to go through all of the elements and
> renumber them. I am a programmer, so, I know since emacs has a language it
> can do this, but I don't have enough reference material to find it. Is
> there a way to do this and could you point me to a reference for learning
> how to do it?
To give you an example, this function will insert a new item tag,
automatically determining the item number:
(defun insert-item-autonumber ()
(interactive)
(let (item-number)
(save-excursion
(re-search-backward "<u_item no=\"\\([0-9]+\\)\">")
(setq item-number (string-to-number (match-string 1))))
(insert "<u_item no=\"" (number-to-string (1+ item-number)) "\">\n")))
Execute it when point is at where the new item tag should be inserted
by typing M-x insert-item-autonumber, or binding this to a key (see
the Emacs manual). The code to renumber a group of item tags is a bit
harder.
The Emacs Lisp manual is available here:
ftp://ftp.gnu.org/gnu/emacs/elisp-manual-20-2.5.tar.gz
or in the corresponding directory of any GNU FTP mirror.
> Question #4:
> I can't type some key combinations. For example, C-M-% should
> invoke the query-replace-regexp command. It just stares at me like
> it's saying "boy are you stupid" ;-) Of course I can type
> Mx-query-replace-regexp but is there any way to get the key
> combination working with a shift key involved?
Perhaps the Mac OS intercepts some key combinations so Emacs never
receives it. Try ESC C-%, or bind it to another key combination (see
`Key Binding' section of the Emacs manual).
> Question #5:
> Is there a way I can download and install other major modes like XML
> editing mode?
If it works on Emacs 20.x on other platforms, there's a good chance it
will work on the Mac port. I'm not familiar with XML modes.
> Question #6:
> I have read where there is a way to get hanging indents to work
> well. When I invoke outline-mode I like for the wrapping of text to
> align with the current level indent. Is this something that can be
> set?
I think this is what you want: read about `adaptive filling' in the
Emacs manual.
> Question #7:
> How do you move up to the parent of the current directory you are
> in. Usually in Unix & Windows there are current and parent
> directory indicators (. And ..) to select in the file list for
> moving to the parent directory. I have noticed they are not in the
> file listings on the Mac version of emacs. Is there a way other
> than re-executing C-x C-f and backing out of the directory by
> deleting part of the path?
In dired mode, type ^ to get to the parent directory. When asked to
enter a filename in the minibuffer after executing a command such as
C-x C-f, you can actually use `..', `../..', etc. to go up to parent
directories. You can also hit tab to see a simpler pathname (with the
dots removed).
Andrew.
|