Dec. 20th, 2006

fivemack: (Default)
My .emacs file contains the line

(set-default-font "7x13")

and indeed whenever I load a file into emacs, it comes up in 7x13.

But if I do C-x 5 2 to get another emacs window, the file in that window appears in a much larger and uglier font with inelegant serifs. How do I really set the default font?

[note: I don't run emacs-client, I edit files with 'emacs foo' on the command-line, so often I have lots of separate emacs processes; also, by 'window' I mean a window-system window rather than whatever emacs's internal jargon 'window' means]
fivemack: (spiky)
What I want: a subroutine footle such that, if you call footle(a,b) twice with the same a,b, it does nothing the second time

What I did:
use strict;
sub footle
{
  my ($a,$b,%done) = @_;
  my $concat = $a.$b;
  if ($done{$concat} == 0)
  {
    print "footling $a $b";
    $done{$concat} = 1;
  }
}

my %isdone = ();

footle("bootle","bumtrinket",%isdone);
footle("bootle","bumtrinket",%isdone);

But this doesn't work because parameters are passed by value.

But if I call as footle("bootle","bumtrinket",\%isdone), which passes isdone by reference, it still does the footling twice.

Even if I put $_[2]=%done before the end of the subroutine, it still does the footling twice.

And if I put print join "*",(keys %done); at the start of the subroutine, it says HASH(0x8188110)footling bootle bumtrinket

So how do I really pass the parameter by reference, as if I'd said void footle(int a, int b, set<string>& done) in C++?

March 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 12th, 2025 03:10 am
Powered by Dreamwidth Studios