--text follows this line--
Here's a short elisp snippet to try in an emacs -Q session:
=====
(defun foo (orig-fun &rest args)
(apply orig-fun args))
(advice-add 'report-emacs-bug :around #'foo)
(advice-add 'pop-to-mark-command :around #'foo)
=====
After evaluating the above, if I do C-h f report-emacs-bug, I get:
=====
report-emacs-bug is an alias for ‘report-emacs-bug’ in ‘emacsbug.el’.
It is bound to <menu-bar> <help-menu> <send-emacs-bug-report>.
(report-emacs-bug TOPIC &optional UNUSED)
Report a bug in GNU Emacs.
Prompts for bug subject. Leaves you in a mail buffer.
=====
But for C-h f pop-to-mark-command, I get:
=====
pop-to-mark-command is an interactive compiled Lisp function in
‘simple.el’.
(pop-to-mark-command)
:around advice: ‘foo’
Jump to mark, and pop a new position for mark off the ring.
(Does not affect global mark ring).
=====
I picked pop-to-mark-command just randomly. I noticed the misinformation for report-emacs-bug (irony!) only. Then at random advised pop-to-mark-command too, but emacs does not misunderstand that advice as alias.
And here comes the twist.. After above, in the same session, once I do M-x report-emacs-bug and then if I do C-h f report-emacs-bug, I then get:
=====
report-emacs-bug is an interactive autoloaded compiled Lisp function
in ‘emacsbug.el’.
It is bound to <menu-bar> <help-menu> <send-emacs-bug-report>.
(report-emacs-bug TOPIC &optional UNUSED)
:around advice: ‘foo’
Report a bug in GNU Emacs.
Prompts for bug subject. Leaves you in a mail buffer.
=====
So what's the mystery? Emacs cannot tell if a function is advised until it is evaluated and executed?
In GNU Emacs 25.0.93.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
of 2016-05-05 built on
Repository revision: 5e814e02f0b0b85fa486975eced09e4a7ed8ce5c
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6 (Santiago)
Configured using:
'configure --with-modules
--prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-25
'CPPFLAGS=-fgnu89-inline -I/home/kmodi/usr_local/6/include
-I/usr/include/freetype2 -I/usr/include' 'CFLAGS=-ggdb3 -O0'
'CXXFLAGS=-ggdb3 -O0' 'LDFLAGS=-L/home/kmodi/usr_local/6/lib
-L/home/kmodi/usr_local/6/lib64 -ggdb3'
PKG_CONFIG_PATH=/home/kmodi/usr_local/6/lib/pkgconfig:/home/kmodi/usr_local/6/lib64/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/lib64/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
foo
nil [2 times]
Type C-x 1 to delete the help window.
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra
help-fns help-mode easymenu cl-loaddefs pcase cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 88305 8121)
(symbols 48 19775 0)
(miscs 40 47 172)
(strings 32 14598 4870)
(string-bytes 1 436699)
(vectors 16 12461)
(vector-slots 8 434860 5020)
(floats 8 168 71)
(intervals 56 264 4)
(buffers 976 12)
(heap 1024 38706 719))