logs archiveIRC Archive / Freenode / #emacs / 2010 / January / 12 / 1
dburger
ggole, so I wouldn't go with replace-regexp ?
ggole
No, I think you need replace-match
Search first, then you can get at the match strings and pass them to replace-match
dburger
search first as in re-search-forward ?
can you point me to some general code of this form ?
I would like to find an "emacs lisp recipes" or "emacs lisp idioms"....
hmmm, maybe here: http://xahlee.org/emacs/elisp_idioms.html
jlf
let's make a web framework in elisp
fledermaus
"What you probably want is a loop like this:
(while (re-search-forward regexp nil t)
(replace-match to-string nil nil))" from the docs for replace-regexp
abbe
wth, emacs migrated to bzr repository, it is so slow :(
reto`
what was it before? git?
abbe
reto`: CVS
reto`
oh, git should be fast I heard...
         

abbe
yes, git is awesome...
dburger
ggole, my first attempt with replace-match is giving me the same error...hmmmm?
OberWrk
so on one machine with the same .emacs my debugger in compile mode is interactive. Comint is set. but on other system it's RO
reto`
how do you guys deal with emacs --daemon and .emacs?
OberWrk
just server-start in .emacs and I alias emacs=somescript which launches emacs if no daemon is running, but emacsclient -c if emacs is running in daemon mode
ggole
dburger: I don't know what "the same error" is
reto`
sometimes I use emacsclient -c, then again -t
OberWrk
I find daemon mode hangs too often
with all the stuff I run in emacs.
dburger
ggole, Invalid use of `\' in replacement text
OberWrk
erc/nmh/jabber/tramp
simard
how can I save a text file in another encoding format ? ie 8859-15 if it was utf-8
reto`
but I will have only the settings of what was running when the daemon was started
dburger
ggole, so it seems that replace-match doesn't allow a lisp expression either - unless I'm using it wrong which wouldn't be the first time.
ggole
dburger: it does not, as I explained before
(except interactively)
dburger
ggole, oh oh, I get it sorry.
ggole, I thought you were telling me to dump replace-regexp and use replace-match, but I still can't give replace-match a lisp expression, so do in code and give it that.
ggole, thanks for the help.
ggole
Why can't you give replace-match a lisp expression? It should be evalled as usual
rgr
OberWrk: beter not to use server-start IMO. Use the emacsclient flag.
ggole
Unless you stuck it in the string
dburger
ggole, I mean a lisp expression buried in a regexp string ala "something \,(+ 3 4)"
ggole
You don't need to bury it in the string, just use concat
         

rgr
OberWrk: e.g my edit command is exec emacsclient --alternate-editor="" -c "$@"
ggole
Or format
lisppaste
ggole pasted "underscore-region" at http://paste.lisp.org/display/93261
dburger
ggole, right, but I was first thinking that these shortcuts might work so thanks for helping me figure out that it won't.
rgr
so defaults to x frame but you can as well do edit -nw file
ggole
Like that, except I don't think case is handled correctly there
re-search magic is screwing it up, I guess
dburger
ggole, yes I think you have to (case-fold-search nil) at some point but not sure if I'm screwing that up.
how to I (case-fold-search nil) only scoped to the function ??
fsbot
Yes
ggole
Ah, that's it
Wrap the function body in (let (case-fold-search) ...)
dburger
ok, that is what I was doing but not sure if right.
thanks.
ggole
Yeah, seems to work now
ryoma
if i want to learn more about a function, is there a way to look it up in info without navigating info?
for commands i can do info-lookup-symbol
junis
emacs says (void-function face-all-attributes) while GNU Emacs Lisp Reference Manual 38.12.3 documents function face-all-attributes .... why is that?...
ggole
ryoma: do you know about C-h f? That doesn't bring up info pages, but the docstring
ryoma
ggole: yes, thanks. i wanted to find it in the info manual without searching for it there. i.e. start a search right away in both emacs and elisp manual
jlf
,df info-apropos
fsbot
info-apropos is an interactive compiled Lisp function in `info.el'.
It is bound to <menu-bar> <help-menu> <more-manuals>
<lookup-subject-in-all-manuals>.
(info-apropos STRING)
Grovel indices of all known Info files on your system for STRING.
Build a menu of the possible matches.
ryoma
my example is window-dedicated-p -- trying to find it in info
that works, thanks jlf
ggole
That or the info index
jlf
yw
ryoma
be nice if it captured the symbol at point. maybe someday i will add that.
jlf
ryoma: i think describe-function does that.. you could probably steal it
rgr
ryoma: i have something for that - context func/var help. hang on,
http://rgr.pastebin.com/d50c70b8b
havent used it in a while and it was early days elisp but it did work.
let me know if it works,
you toggle contex help on / off and when moving through elisp it automatically updates the *Help* buffer.
shyam
fledermaus: finally i have a problem with url-http-real-basic-auth-storage. it stores auth for the same site under different tags and it all messess up:(
fledermaus
example?
fsbot
", gnu" to query about gnu .. + other entries
jlf
,yow
fsbot
I want to TAKE IT HOME and DRESS IT UP in HOT PANTS!!
shyam
fledermaus: ah.. sorry i'll read a bit more and come back..
the problem i had was that i set a custom tag .. may be i'll follow the method url does to get the tag from filename..
(Action) copies file setting section from url-auth.el
snogglethorpe
e1f: you're right, i did enjoy it
shyam
based on a condition, a set of variables have to be intialized (as in let) in two ways and the same piece of code to be run after that.. how to write it the best way?
ggole
(let (a b c) (if condition (setq a "a" b "b" c "c") (setq a "x" b "y" c "z")) (afterwards))
shyam
hmm.. setq itself..
ggole
If you prefer strictly functional code you could just use let and if
shyam
how is that?
ggole
(let ((a (if cond "a" "x")) (b (if cond "b" "y"))) (afterwards))
shyam
that will certainly look awkward :)
oh ok..
fledermaus
,sudoku 000 300 900 040 070 050 005 008 000 300 400 700 060 080 010 004 005 002 200 500 000 050 010 070 006 009 008
fsbot
618 354 927 943 271 856 725 698 431 391 462 785 562 987 314 874 135 692 287 543 169 459 816 273 136 729 548
28 search ops; 12 squares; 0.98 seconds;
kodein
cool.
fledermaus
,sudoku "4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......"
fsbot
417 369 825 632 158 947 958 724 316 825 437 169 791 586 432 346 912 758 289 643 571 573 291 684 164 875 293
112 search ops; 11 squares; 1.66 seconds;
fledermaus
(Action) declares it to be working.
aidalgol
Is there an easier way to apply a patch to a Emacs Debian package than to apply it to the source package and build it yourself?
fledermaus
if the patch is to something shipped as elisp, you can just copy the elisip file to ~/src/elisp, modify it, and make sure your copy is loaded.
otherwise, no.
ggole
If the patch is lisp, you might get away with.... yeah, what he said
aidalgol
It's what's described here <http://www.emacswiki.org/emacs/SmtpAuth>.
fledermaus
yes, just copy smptpmail.el to one of your directories, apply the patch and load your copy.
aidalgol
OK, thanks!
Is that just (load "/path/to/file") ?
ggole
,install
(Action) waits for fsbot
fledermaus
bot's still warming up
fsbot
From memory, install is [0] To install a <file>.el, save it to, say ~/elisp
ggole
Does he do much work at startup?
fsbot
[1] add to the beginning of ~/.emacs: (add-to-list 'load-path "~/elisp"),
[2] now FOLLOW THE INSTALLATION INSTRUCTIONS IN THE FILE, typically adding (require '<file>) to the end of ~/.emacs, ..[Type ,more]
jlf
loading the bbdb database takes a while
fledermaus
ggole: a bit, but it;s mostly IRC lag afaict
ggole
OK
fledermaus
only sees IRC messages after a bit of a delay, it seems.
ggole
aidalgol: anyway, chances are that add-to-list and require should see you through
aidalgol
ggole: Thanks!
(Action) yanks last several lines of #emacs to a file buffer and saves.
matt812_
/ignore -channels #emacs * JOINS PARTS QUITS NICKS
bremner
/ignore -channels #emacs TYPOS
benny
:-P
ryoma
what does that * do?
matt812_
hehe. sorry.
ryoma: if you are asking me, that is the nick/channel mask
means to ignore for all nicks
bremner
hmph. Org-mode is getting a bit sluggish with a 500k table
benny
500k cells or 500k rows?
bremner
bytes
only 122 rows
jlf
"Suspicious continuation in line 216. Save anyway?" <- GNUmakefile mode ftw
consolers
Makefile has modified time in the future
fledermaus
,sudoku-solve 000 800 400 070 020 080 006 009 003 000 700 000 030 090 040 009 006 005 800 300 700 040 060 020 003 007 006
fsbot
Nooo! Sudoku search depth 800 exceeded at 14.96 seconds
fledermaus
hmm.
should have ben faster than that.
,sudoku-solve 000 800 400 070 020 080 006 009 003 000 700 000 030 090 040 009 006 005 800 300 700 040 060 020 003 007 006
fsbot
592 873 461 371 624 589 486 159 273 654 738 912 238 591 647 719 246 835 865 312 794 147 965 328 923 487 156
14 search ops; 6 squares inspected; 0.57 seconds
bpalmer
using CLP ?
fledermaus
clp?
bpalmer
constraint logic programming
fledermaus
oh, yes.
bpalmer
which library?
fledermaus
constraint propagation, at any rate, if that's the same thing.
one I wrote.
it's not a generic CLP library, it just applies the main sudoku constraints plus a bit of extra deduction, then searches the resulting grid.
if that's what you wanted to know.
bpalmer
aye
fledermaus
not optimised or anything, but I cba to hack on it any more.
wdouglas
Hey all I'm having trouble adding a hook which requires the file the hook is being added in. If I eval the buffer first it works correctly but that isn't working for me when I try to autoload for an elpa install.
Any thoughts on how I need to change the way I'm trying to load?
bpalmer
wdouglas: I'm not sure I follow your question.
"a hook which requires the file the hook is being added in" ?
sm
when I use ps-print, eg ps-print-buffer, the output is blank pages with the bottom part of a shaded box at the top. How can I fix this ?
boscop
http://www.youtube.com/watch?v=hkDD03yeLnU
wdouglas
bpalmer: so it is hard to say exactly but I'm doing an add-hook which calls a function which requires the file I am providing that the add-hook is located in
fledermaus
add-hook doesn't call the function you add to the hook
it just puts the symbol in the hook list variable.
(Action) goes to sleep
wdouglas
Hrm well when I try and install the buffer with package-install-from-buffer I get warnings about invalid functions and if I eval the buffer first I don't.
dburger
how can I convert from an ascii escape to the character ?? (ascii-string-to-char "%3f") gives me 37, not the character.
ggole
Characters are integers in GNU emacs
bremner
as kernighan and ritchie intended
alephnull
dburger: You were expecting "?"
dburger
alephnull, yes, how to get ?
alephnull
dburger: You are using the wrong function. ,,(url-unhex-string "%3f")
fsbot
ERROR: Symbol's function definition is void: fs-url-unhex-string
alephnull
dburger: You might want to wrap decode-coding-string around that.
(Action) slaps some sense into fsbot
,(require 'url)
fsbot
url
alephnull
,,(url-unhex-string "%3f")
fsbot
oops, error. Symbol's function definition is void: fs-url-unhex-string
alephnull
dburger: I give up. Anyway, that's the function to use. I have it in my emacs-snapshot.
dburger
alephnull, cool, well no need to require in 22. ?
alephnull, seems that I already have those funcs.
lisppaste
dburger pasted "untitled" at http://paste.lisp.org/display/93266
dburger
attempting to write "url-unhex-region" but I get an error, apparently I don't understand how match-string works correctly: http://paste.lisp.org/display/93266
can someone explain what my error is?
thinking (match-string 0) should return entirety of previous match as a string,
it appears that it is returning something else.
no, it appears to be something that url-unhex-string is doing.
ahh - url-unhex calls string-match and causes it to barf?
lisppaste
dburger pasted "untitled" at http://paste.lisp.org/display/93267
dburger
is this acceptable or crappy in some other way: http://paste.lisp.org/display/93267
ggole
If some function stomps on your match data, just save it before calling that function
rgr
lol. Its great poking ones nose in to see someone having a fight with fsbot ....
consolers
even better to see fsbot lose!
johnw
`save-match-data' is a useful function in that rgeard
er, macro
quotemstr
Holy cow.
You just can't make this stuff up.
« prev 1 2 3 4 5 6 7 next »