LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-18-2009, 03:17 PM   #1
jgombos
Member
 
Registered: Jul 2003
Posts: 256

Rep: Reputation: 32
emacs cannot launch a function from the commandline


I want to launch emacs and have it immediately launch into pwsafe-mode.

My .emacs file properly loads the pwsafe.el file, so everything works when invoking M-x pwsafe. But when I run this on the CLI:

emacs -f pwsafe

the output message is indicates a missing argument:
Code:
command-line-1: Wrong number of arguments: (lambda (force) "Major mode to interact with the command line password safe pwsafe.
Queries the passwords from the password safe and displays them in the buffer *pwsafe-list*.
The following keys are defined:
\\{pwsafe-list-mode-map}" (interactive "P") (if (and (not force) (not (string= (buffer-name) "*pwsafe-list*")) (get-buffer "*pwsafe-list*")) (pop-to-buffer "*pwsafe-list*") (let ((database-file-name (pwsafe-current-database-name))) (if (file-exists-p database-file-name) (if pwsafe-use-long-listing (pwsafe-run (quote list) "-l" "-f" database-file-name) (pwsafe-run (quote list) "-f" database-file-name)) (when (yes-or-no-p (format "pwsafe database %s does not exist - create it? " database-file-name)) (pwsafe-createdb) (with-current-buffer (get-buffer "*pwsafe*") (delete-region (point-min) (point-max))) (pwsafe-list-passwords)))))), 0
mouse-minibuffer-check: Minibuffer window is not active [2 times]
Any ideas how to fix or workaround?

Last edited by jgombos; 09-19-2009 at 09:06 AM.
 
Old 09-19-2009, 12:21 PM   #2
gsan70
LQ Newbie
 
Registered: Sep 2009
Location: New York
Distribution: Slackware 14.0
Posts: 2

Rep: Reputation: 0
You can set a default mode in emacs. Add the following line in your .emacs file,

(setq default-major-mode 'pwsafe-mode)
 
Old 09-19-2009, 12:46 PM   #3
jgombos
Member
 
Registered: Jul 2003
Posts: 256

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by gsan70 View Post
You can set a default mode in emacs. Add the following line in your .emacs file,

(setq default-major-mode 'pwsafe-mode)
Thanks for the suggestion, but it was the same problem. Apparently there is no CLI or configuration equivalent to typing M-x pwsafe.

I've extracted the relevant code that executes:
Code:
;;;###autoload
(defun pwsafe (force)
  "Major mode to interact with the command line password safe pwsafe.
Queries the passwords from the password safe and displays them in the buffer *pwsafe-list*.
The following keys are defined:
\\{pwsafe-list-mode-map}"
  (interactive "P")
  (if (and (not force)
           (not (string= (buffer-name) "*pwsafe-list*"))
           (get-buffer "*pwsafe-list*"))
      (pop-to-buffer "*pwsafe-list*")
...
So there really is an argument, which apparently is not needed when running interactively. So the question is, how can I pass "nil" or "t" or something to a function that is run on the CLI?

[EDIT] Got my solution:
Code:
emacs --eval='(pwsafe nil)'

Last edited by jgombos; 09-19-2009 at 12:52 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alt no longer META key when using in-terminal option of Emacs (emacs -nw) frznchckn Linux - Software 1 06-02-2007 02:41 AM
How to make emacs run on commandline under X pyre Linux - General 3 11-14-2006 09:35 PM
Emacs LISP - function and keymap? jantman Programming 5 09-28-2006 11:59 AM
making bash function the same whether in commandline or gui lnxmacusr Linux - General 11 01-07-2005 08:44 PM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration