To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 7953
7952  |  7954
Subject: 
ldraw-mode.el external viewer suggestion
Newsgroups: 
lugnet.cad.dev
Date: 
Fri, 11 Oct 2002 16:29:50 GMT
Viewed: 
340 times
  
I was comparing the various hoser programs last night
when I realized there's no command to launch an external
ldraw viewer program from within the emacs ldraw-mode.
Yeah, you can launch one from an icon or another window, but
sometimes it's nice to just pop up a window on the DAT file
you're working on without leaving emacs.

It's been at least 10 years since I wrote any elisp, so I'm not
up on all the latest win32 variables and such, but this seems to
work for me on Win2k.  It might be nice if someone more
knowledgable in elisp than I could create a variable (or list?) to
hold the arguments (besides the filename) for the viewer program.
The code below starts ldglite in polling mode (-p) in a 640x480
window (-v3) using the l3 parser (-l3).


;; ***************************************************************
(defvar ldraw-viewer-path (if (string= system-type "windows-nt")
"C:/projects/ldglite/ldglite"
       "/usr/local/share/ldglite")
  "Base Ldraw file viewer path.

If you're on a MSDOS system, you may need to put something like
    (setq ldraw-viewer-path \"C:/projects/ldglite/ldglite.exe\")
in your .emacs file.  Note the forward slashes in the path.")

;; ***************************************************************
(defun ldraw-launch-viewer ()
  "This is a command to launch an external viewer on the model file."
  (interactive)
  (let ((w32-start-process-show-window t))
    (start-process "ldraw-viewer-process" "*ldrawviewer*"
       ldraw-viewer-path "-v3" "-p" "-l3" buffer-file-name)
    )
  )

;; ***************************************************************
;; ***************************************************************
;; ***************************************************************

I also added a key combo in the section with all the define-key stuff.

  (define-key ldraw-mode-map "\C-c\C-x" 'ldraw-launch-viewer)

Enjoy,

Don



Message has 2 Replies:
  Re: ldraw-mode.el external viewer suggestion
 
Don, That really sounds like a great idea. Have you sent Frederick an email about it? He's really on the ball on this sort of thing and always very quick to return an answer. I think that ldraw-mode is the best program for working with bendable (...) (22 years ago, 12-Oct-02, to lugnet.cad.dev)
  Re: ldraw-mode.el external viewer suggestion
 
(...) Good idea! Thanks, I have incorporated your code in LDraw-mode now. I added the ability to change the default parameters passed to the viewer, in case anybody wants to do that. I have considered adding this funcion myself, but I never saw the (...) (22 years ago, 12-Oct-02, to lugnet.cad.dev)

10 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR