[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: where-are-we: find out the context when reading (any) source code

From: Andreas Röhler
Subject: Re: where-are-we: find out the context when reading (any) source code
Date: Wed, 18 Aug 2010 18:36:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20100711 Thunderbird/3.0.6

Am 18.08.2010 17:31, schrieb Haojun Bao:
Hi, all

I have wrote a little lisp and a perl script to tell where I am when I'm
reading source code. The lisp code is short:

     (defun where-are-we ()
          1 (point)
          (concat "where-are-we "
                  (or (buffer-file-name) (buffer-name))
                  (format " %s" tab-width)))))

The perl script (also named where-are-we) is attached. When invoked on
the last line of the above lisp code, the output is like following:

     /home/bhj/windows-config/.emacs:1005:              (format " %s" 
         (defun where-are-we ()
              (concat "where-are-we "
     =>                (format " %s" tab-width)))))

Another example from reading Android source code:

                 outFlags[codeIndex] = 1;
          * Inspect the known devices to determine whether physical keys exist 
for the given
          * framework-domain key codes.
         bool EventHub::hasKeys(size_t numCodes, int32_t* keyCodes, uint8_t* 
outFlags) {
             for (size_t codeIndex = 0; codeIndex<  numCodes; codeIndex++) {
                 for (int n = 0; (n<  mFDCount)&&  (outFlags[codeIndex] == 0); 
n++) {
                     if (mDevices[n]) {
                         if (!err) {
                             for (size_t sc = 0; sc<  scanCodes.size(); sc++) {
                                 if (test_bit(scanCodes[sc], 
mDevices[n]->keyBitmask)) {
     =>                               outFlags[codeIndex] = 1;

Supposedly this can be useful when reading source code and taking note,
even better if used with remember.el. That way, you can easily write a
scenario analysis about which function called which function and so

Hope you can find it useful.

Hi, thanks,

a home-brew I use quite often because of its copying is

(defun copy-buffer-file-name ()
  "Display and copy buffer-file-name or default-directory. "
  (let ((pfn (buffer-file-name))
        (verz default-directory))
    (if pfn
        (kill-new pfn)
      (kill-new verz)))
  (message "%s" (car kill-ring)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]