all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Open files in a new frames from command line
Date: Mon, 02 Feb 2004 15:17:36 -0700	[thread overview]
Message-ID: <401ECC80.7050301@yahoo.com> (raw)
In-Reply-To: 87llnpatnz.fsf@ID-87814.user.dfncis.de

Oliver Scholz wrote:

> There is no such command line option, but you could make your own
> command line option, if you put something like this (only slightly
> tested) into your .emacs:
> 
> (defun my-is-option-p (str)
>   "Return non-nil if STR is an command line option."
>   (string-match "^--?"
> 		str))
> 
> (defun my-command-line-make-new-frames ()
>   "Process open each files in a new frame.
> This function is supposed to be an element of
> `command-line-functions' (q.v.). Its functionality is triggered
> if ARGI is \"--as-frames\" and opens each element in
> COMMAND-LINE-ARGS-LEFT not starting with a slash as a file in a
> separate frame."
>   (when (string= argi "--as-frames")
>     (unless (my-is-option-p (car command-line-args-left))
>       (find-file (pop command-line-args-left)))
>     (while (and command-line-args-left
> 		(not (my-is-option-p
> 		      (car command-line-args-left))))
>       (find-file-other-frame
>        (pop command-line-args-left))
>       t)))
> 
> (push 'my-command-line-make-new-frames
>       command-line-functions)

It's a lot easier to use command-switch-alist:

(setq command-switch-alist
       (cons '("--other-frame" . find-file-other-frame-command-line-arg) ; -R
	    command-switch-alist))

(defun find-file-other-frame-command-line-arg (switch)
   "Visit next command line argument (after SWITCH) in a new frame."
   ;; (prog1 (car x) (setq x (cdr x))) == (pop x):
   (find-file-other-frame (prog1 (car command-line-args-left)
			   (setq command-line-args-left
				 (cdr command-line-args-left)))))

 > Use as
 >
 > emacs --as-frames lirum.txt larum.txt

Invoke as emacs --other-frame FILE ...

-- 
Kevin Rodgers

  reply	other threads:[~2004-02-02 22:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1057.1074645741.928.help-gnu-emacs@gnu.org>
2004-01-21  1:11 ` Open files in a new frames from command line Kin Cho
2004-01-21  1:14 ` Christopher J. White
2004-01-29  8:20 ` Kai Grossjohann
2004-02-04 22:25   ` Joe Casadonte
2004-01-30 23:44 ` Oliver Scholz
2004-02-02 22:17   ` Kevin Rodgers [this message]
2004-02-03  4:38     ` Oliver Scholz
     [not found] <mailman.1752.1075763607.928.help-gnu-emacs@gnu.org>
2004-02-03 17:46 ` Kevin Rodgers
2004-02-02 23:12 Bingham, Jay
  -- strict thread matches above, loose matches on Subject: below --
2004-01-29 16:46 Bingham, Jay
2004-01-21  1:05 Michael B. Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=401ECC80.7050301@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.