From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: ledger, add-entry Date: Tue, 04 May 2010 20:13:11 +0200 Organization: ThierryVolpiatto Message-ID: <8739y7o7rc.fsf@tux.homenetwork> References: <87y6hrrtlz.fsf@online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1273043118 12688 80.91.229.12 (5 May 2010 07:05:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 May 2010 07:05:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 05 09:05:15 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9YfS-0006zQ-3f for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 09:05:14 +0200 Original-Received: from localhost ([127.0.0.1]:39383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9YfR-0001zA-FP for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 03:05:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9Mg6-0008BB-AJ for help-gnu-emacs@gnu.org; Tue, 04 May 2010 14:17:06 -0400 Original-Received: from [140.186.70.92] (port=40585 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9Mg0-00084U-Dp for help-gnu-emacs@gnu.org; Tue, 04 May 2010 14:17:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9Mfx-0000LV-9K for help-gnu-emacs@gnu.org; Tue, 04 May 2010 14:17:00 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:50602) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9Mfw-0000LC-Rx for help-gnu-emacs@gnu.org; Tue, 04 May 2010 14:16:57 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O9Mfs-0007Lo-5Y for help-gnu-emacs@gnu.org; Tue, 04 May 2010 20:16:52 +0200 Original-Received: from 234.77.197-77.rev.gaoland.net ([77.197.77.234]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 May 2010 20:16:52 +0200 Original-Received: from thierry.volpiatto by 234.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 May 2010 20:16:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 78 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 234.77.197-77.rev.gaoland.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUHBARgJRFPS0WbMBTC TSG/uJs0yyVHAAAACXBIWXMAAAsSAAALEgHS3X78AAAACXZwQWcAAAAwAAAAMADO7oxXAAABpUlE QVQ4y3VTQXKDMAyUnD7AwvQOhtxj5N4LFh9ow/+/UtlpM0BczWSS0Wola7UBeEb3+3kJ/5p9ZLz3 UI0n0J0Y4K/lh1nG24FhlJOR2LdSKtpV5gfi/Zd+NdaJBbB4D5N0JnfUIVp6obZURkJwS2a8b9uX AkgxA5gCEcknAH1s2z0DPooWmjGKcJR+HNZt+9bm0GtGRycRuZGs98Ffr02vABWGopIAhmXmxnQN BwBXZjgFLHRoqbfeYxCLWqsjLyKhbEHW+A5nEs699Q2O80ALrgHTmUTy6P0MnKyKQpKHpoNWokxs F0D5VegvWmEozyE6nuMiS98mWzlUQ9bW8qYfqOaFtzWlYCqGeIs6HEyl08jkrxUG9MF5ipXpOOpd ZMoXPPVSLWJiiwNNB+eRSyxJZmQKcacikgucnCRiHuJOLmyYJRDPwOqAvY4pA+Wy+VS8G26BAsdb Ph2Hw7ORy/H0IOG0TnaM8Cp0XrFYyU0v2z8AqkifPVbLZ0qo/gsRg60C7p+8Ov9jrUIxFde+jnAq X42hyp/c+ZcnVyUYBarrqZt3+R8450png3cWKgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAwOC0wNS0z MVQyMjoxNDoyMiswMjowMK3VBDcAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDctMTAtMjhUMTc6MDg6 NDgrMDE6MDDLdIcLAAAAEXRFWHRqcGVnOmNvbG9yc3BhY2UAMix1VZ8AAAAgdEVYdGpwZWc6c2Ft cGxpbmctZmFjdG9yADJ4MiwxeDEsMXgxSfqmtAAAAABJRU5ErkJggg== User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:2UQGMKrRcfgbaI3PDtuUoW2KZqg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73322 Archived-At: henry atting writes: > Maybe someone can answer this question here; since I have no google > account the ledger group is inaccessible for me. > > When I add an entry to my ledger file (ledger-add-entry) a new entry > will be created according to an older one with the same payee. As far as > good but how can I suppress the price to be filled in either. As > the price usually differs you always have to delete the old rate first. > > henry Here functions i use here, they are for my personal use and work fine here but no guarantee it will work on your side, adapt for yourself. They use anything-comp-read that replace completing-read, so if you don't use anything, replace anything-comp-read by completing-read. ,---- | (defun ledger-add-expense (date payee categorie type amount) | (interactive | (list (read-string "Date: " (tv-cur-date-string :separator "/")) | (read-string "Payee: ") | (anything-comp-read "Categorie: " (ledger-collect-categories)) | (anything-comp-read "Type: " '("Visa" "Check" "Tip" "Prelevement")) | (read-string "Amount: "))) | (let (numcheck defnumcheck) | (with-current-buffer (find-file-noselect (getenv "LEDGER_FILE")) | (goto-char (point-max)) | (when (string= type "Check") | (setq defnumcheck (save-excursion | (when | (re-search-backward | "\\(^[0-9]\\{4\\}/[0-9/]*\\)\\(.*\\)\\(\([0-9]*\)\\)" nil t) | (replace-regexp-in-string "\(\\|\)" "" (match-string 3))))) | (setq defnumcheck (int-to-string (1+ (string-to-number defnumcheck)))) | (setq numcheck (read-string "CheckNumber: " defnumcheck))) | (insert (concat | date " " payee (or (and numcheck (concat " (" numcheck ")")) "") "\n " | "Expenses:" categorie (make-string 8 ? ) "€ " amount "\n " | "Liabilities:Socgen:" type "\n\n")) | (goto-char (point-min)) | (ledger-align-device 1) | (save-buffer)))) | | (defun ledger-add-income (date payee categorie account amount) | (interactive | (list (read-string "Date: " (tv-cur-date-string :separator "/")) | (read-string "Payee: ") | (anything-comp-read "Categorie: " (ledger-collect-categories)) | (anything-comp-read "Account: " '("Socgen:Checking")) ;; TODO add completion here | (read-string "Amount: "))) | (with-current-buffer (find-file-noselect (getenv "LEDGER_FILE")) | (goto-char (point-max)) | (insert (concat | date " " payee "\n " | "Assets:" account (make-string 8 ? ) "€ " amount "\n " | "Income:" categorie "\n\n")) | (goto-char (point-min)) | (ledger-align-device 1) | (save-buffer))) | | (defun ledger-collect-categories () | (let (categories result) | (with-current-buffer (find-file-noselect (getenv "LEDGER_FILE")) | (goto-char (point-min)) | (while | (re-search-forward | "\\(^ *Expenses\\|Income\\):\\([^ €0-9\n]*\\)" (point-max) t) | (setq result (match-string 2)) | (unless (or (member result categories) | (string= result "")) | (push result categories)))) | categories)) `---- -- Thierry Volpiatto Gpg key: http://pgp.mit.edu/