bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18014: 24.3; Unused Lexical argument warning, when argument is used


From: Matthew Fidler
Subject: bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
Date: Mon, 14 Jul 2014 07:28:44 -0500

As a follow-up, when changing key to _key, I get the following warning
 
Compiling file e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon Jul 14 07:27:43 2014
ergoemacs-translate.el:695:1:Warning: argument `_key' not left unused
 
It can't be both...


On Mon, Jul 14, 2014 at 7:25 AM, Matthew Fidler <matthew.fidler@gmail.com> wrote:

I'm getting a warning  for ergoemacs-translate:

Compiling file e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon Jul 14 07:17:14 2014
ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'

I do use the argument key to calculate the translation, but the compiler
claims I am not.  I'm not sure if it is a bug in the warning or a bug in
my code.  For now, I can change key to _key to ignore the warning, but I
do think that this is an invalid warning.

Here is the offending function:

(defun ergoemacs-translate (key)
  "Translates KEY and returns a plist of the translations.

:shift-translated
    S-a    -> a
    M-S-a  -> M-a
    C-S-a  -> C-a
    Anything without shift is nil.

All other translations are defined in `ergoemacs-translations'.

There are also :XXX-key and :XXX-pretty for actual key-strokes
and `ergoemacs-pretty-key' descriptions.

"
  (let* ((ret (gethash key ergoemacs-translate-hash))
         (orig-key (or (and (stringp key) key) (key-description key)))
         case-fold-search
         only-key
         shift-translated
         (ergoemacs-use-ergoemacs-key-descriptions t)
         shifted-key
         unshifted-key)
    (if ret ret
      (cond
       ((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
        (setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
        (if (string-match "S-" key)
            (setq shifted-key (replace-match "" t nil key))
          (setq shifted-key (concat "S-" key))))
       (t
        (setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
              shifted-key (assoc only-key ergoemacs-shifted-assoc))
        (when shifted-key
          (setq shifted-key (cdr shifted-key)))))
      (when (and (string-match "\\([A-Z]\\)$" key)
                 (not (string-match "\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" key)))
        (setq key
              (replace-match
               (concat "S-" (downcase (match-string 1 key))) t t key)))
      (when shifted-key
        (setq unshifted-key only-key)
        (unless (string-match "\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)" shifted-key)
          (when (string-match "[A-Z]" shifted-key)
            (setq shifted-key (concat "S-" (downcase shifted-key))))
          (when (string-match "[A-Z]" unshifted-key)
            (setq unshifted-key (concat "S-" (downcase unshifted-key))))))
      (when (string-match "S-" key)
        (setq shift-translated (replace-regexp-in-string "S-" "" key t)))
     
      (if shift-translated
          (progn
            (setq ret (plist-put ret ':shift-translated (ergoemacs-translate-shifted shift-translated)))
            (setq ret (plist-put ret ':shift-translated-key (read-kbd-macro (ergoemacs-translate-shifted shift-translated) t)))
            (setq ret (plist-put ret ':shift-translated-pretty (ergoemacs-pretty-key shift-translated))))
        (setq ret (plist-put ret ':shift-translated nil))
        (setq ret (plist-put ret ':shift-translated-key nil))
        (setq ret (plist-put ret ':shift-translated-pretty nil)))
     
      (when shifted-key
        (setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted shifted-key)))
        (setq ret (plist-put ret ':shifted-key (read-kbd-macro (ergoemacs-translate-shifted shifted-key) t)))
        (setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key shifted-key))))
      (when unshifted-key
        (setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted unshifted-key)))
        (setq ret (plist-put ret ':unshifted-key (read-kbd-macro (ergoemacs-translate-shifted unshifted-key) t)))
        (setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key unshifted-key))))
      (setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
                                      (concat "C-" unshifted-key))))
      (setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret ':ctl) t)))
      (setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key (plist-get ret ':ctl))))

      (setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
                                      (replace-regexp-in-string
                                       "\\<[CSMS]-" "" key))))
      (setq ret (plist-put ret ':raw-key  (read-kbd-macro (plist-get ret ':raw) t)))
      (setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
                                             (plist-get ret ':raw))))
      (if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
          (progn
            (setq ret (plist-put ret ':raw-shift
                                 (ergoemacs-translate-shifted
                                  (replace-regexp-in-string
                                   "\\<[CSM]-" ""
                                   (cdr (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc))))))
            (setq ret (plist-put ret ':raw-shift-key
                                 (read-kbd-macro (plist-get ret ':raw-shift) t)))
            (setq ret (plist-put ret ':raw-shift-pretty
                                 (ergoemacs-pretty-key
                                  (plist-get ret ':raw-shift)))))
        (setq ret (plist-put ret ':raw-shift nil))
        (setq ret (plist-put ret ':raw-shift-key nil))
        (setq ret (plist-put ret ':raw-shift-pretty nil)))
     
      (setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
                                      (concat "M-" unshifted-key))))
      (setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret ':alt) t)))
      (setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key (plist-get ret ':alt))))
     
      (when unshifted-key
        (setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
                                            (concat "M-C-" unshifted-key))))
        (setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get ret ':alt-ctl) t)))
        (setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl)))))

      (when shifted-key
        (setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
                                              (concat "C-" shifted-key))))
        (setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro (plist-get ret ':ctl-shift) t)))
        (setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':ctl-shift))))
        (setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
                                              (concat "M-" shifted-key))))
        (setq ret (plist-put ret ':alt-shift-key (read-kbd-macro (plist-get ret ':alt-shift) t)))
        (setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-shift))))
        (setq ret (plist-put ret ':alt-ctl-shift (ergoemacs-translate-shifted
                                                  (concat "M-C-" shifted-key))))
        (setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro (plist-get ret ':alt-ctl-shift) t)))
        (setq ret (plist-put ret ':alt-ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
      (maphash
       (lambda(key plist)
         (setq ret (ergoemacs-translation-install plist orig-key ret)))
       ergoemacs-translations)
      (puthash orig-key ret ergoemacs-translate-hash)
      (puthash key ret ergoemacs-translate-hash)
      ret)))


In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $EMACSDATA: C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
  value of $EMACSDOC: C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
  value of $EMACSLOADPATH: C:\Users\fidlema3\EmacsPortable.App\App\eps\..\site-lisp;C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\lisp
  value of $LANG: en
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  eldoc-mode: t
  rainbow-mode: t
  show-paren-mode: t
  golden-ratio-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  Info-breadcrumbs-in-mode-line-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  savehist-mode: t
  global-linum-mode: t
  linum-mode: t
  global-subword-mode: t
  subword-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  ido-ubiquitous-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  auto-indent-global-mode: t
  auto-indent-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  helm-mode: t
  helm-match-plugin-mode: t
  helm-occur-match-plugin-mode: t
  delete-selection-mode: t
  ergoemacs-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  flyspell-mode: t
  recentf-mode: t
  tooltip-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Recent input:
<down-mouse-1> <drag-mouse-1> <down-mouse-1> <mouse-1>
M-3 <apps> g e r r g o e m a c s - t h e m e - <return>
<apps> y e r g o e m a c s - t r a n <return> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo>
<down-mouse-1> <mouse-2> <wheel-down> <wheel-down>
<wheel-down> <down-mouse-1> <mouse-1> M-u M-j o r i
M-e M-e M-e M-e M-e M-e M-e M-e M-h o r i g - k e y
M-h M-h M-j M-j M-j M-e M-e M-e M-e M-e M-e M-e M-e
M-e M-e M-i M-i M-i M-i M-u M-. C-q ) M-e M-n M-n M-n
M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n C-w C-g
C-z M-u M-u M-u M-u M-u M-u M-u M-u M-u M-m M-y M-y
M-i M-8 M-8 <apps> e e a n d SPC <apps> e e s t r i
n g p SPC k e y M-i SPC M-l M-l M-l M-n M-8 <apps>
e e o r SPC M-. M-n M-n SPC <apps> e e k e y - d e
s c r i p t i o n SPC k e y M-e M-e M-e M-e M-e M-e
M-e M-e M-e M-e M-8 M-x <backspace> <apps> r <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<down-mouse-1> <mouse-1> <apps> w M-r M-3 <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<help-echo> <down-mouse-1> <mouse-2> <help-echo> <down-mouse-1>
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1>
<lwindow> <down-mouse-1> <mouse-1> M-SPC M-. M-c <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <send-bug-report>

Recent messages:
Mark set
Mark saved where search started [2 times]
Quit
Type 8 to expand again, - to contract, 0 to reset [3 times]
Saving file e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el
Compiling e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
Compiling e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc

Load-path shadows:
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals hides c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/highlight-symbol-20130628.1552/.dir-locals
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals hides c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/js2-mode-20131118.1516/.dir-locals
e:/EmacsPortable.App/Data/start/shared/init hides c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/init
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/custom hides c:/Users/fidlema3/EmacsPortable.App/App/eps/../emacs-24.3/lisp/custom
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals hides c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/gnus/.dir-locals
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/cl-lib-0.3/cl-lib hides c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/emacs-lisp/cl-lib

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils expand-region
text-mode-expansions the-org-mode-expansions html-mode-expansions
er-basic-expansions expand-region-custom expand-region-core misearch
multi-isearch ergoemacs-macros image-file vc-git helm-misc
browse-kill-ring ruler-mode mule-util diminish eldoc rainbow-mode melpa
o-blog o-blog-bootstrap o-blog-i18n o-blog-grid o-blog-source
o-blog-alert time-stamp html2text sgml-mode htmlize maxframe
w32-fullscreen epshell paren golden-ratio keyfreq solarized-light-theme
solarized info+ tabbar-ruler color tabbar savehist linum-off linum
subword extend-dnd dired+ iimage ob-ditaa ob-clojure ob-haskell ob-js
ob-python ob-ruby ob-perl ob-plantuml ob-R ob-sh org-clock org-exp
ob-exp org-exp-blocks org-agenda textmate-to-yas texmate-to-yas
textmate-import texmate-import yasnippet ido-ubiquitous pos-tip
auto-complete-config auto-complete popup auto-indent-mode
smartparens-config smartparens dash helm-mode helm-files image-dired
dired-x dired-aux thingatpt helm-buffers helm-elscreen helm-tags
helm-bookmark helm-adaptative helm-info helm-net browse-url xml url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap helm-plugin helm-locate helm-help
helm-match-plugin helm-grep helm-regexp grep helm-external helm-utils
dired compile helm printing ps-print ps-def lpr ergoemacs-menus delsel
ergoemacs-mode two-column ergoemacs-advices cus-edit cus-start cus-load
ergoemacs-extras ergoemacs-shortcuts ergoemacs-translate descr-text
help-mode ergoemacs-functions ergoemacs-modal ergoemacs-unbind edmacro
kmacro ergoemacs-themes ergoemacs-theme-engine eieio-base
ergoemacs-layouts undo-tree diff ess-smart-underscore ess ess-inf
ess-mode ess-noweb-mode ess-utils ess-custom executable ess-compat
ess-R-object-tooltip ac-helm-autoloads ace-jump-mode-autoloads
auctex-autoloads tex-site auto-compile-autoloads auto-complete-autoloads
auto-indent-mode-autoloads autopair-autoloads bm-autoloads
browse-kill-ring-autoloads diminish-autoloads dired+-autoloads
ergoemacs-mode-autoloads ess-smart-underscore-autoloads evil-autoloads
evil-numbers-autoloads expand-region-autoloads extend-dnd-autoloads
flx-ido-autoloads flx-autoloads fold-dwim-autoloads
golden-ratio-autoloads goto-chg-autoloads helm-autoloads help+-autoloads
highlight-symbol-autoloads htmlize-autoloads icicles-autoloads
ido-ubiquitous-autoloads ido-vertical-mode-autoloads info+-autoloads
js2-mode-autoloads finder-inf keyfreq-autoloads lacarte-autoloads
linum-off-autoloads melpa-autoloads monokai-theme-autoloads
multi-term-autoloads multiple-cursors-autoloads nsis-mode-autoloads
ntcmd-autoloads org-cua-dwim-autoloads org-outlook-autoloads org-outlook
org-protocol org-readme-autoloads lib-requires-autoloads
header2-autoloads http-post-simple-autoloads org-table-comment-autoloads
packed-autoloads magit-autoloads git-rebase-mode-autoloads
git-commit-mode-autoloads paredit-autoloads phi-search-autoloads
popup-autoloads pos-tip-autoloads powerline-autoloads powerline
powerline-separators powerline-themes projectile-autoloads
rainbow-mode-autoloads s-autoloads slime-autoloads smartparens-autoloads
dash-autoloads smex-autoloads solarized-theme-autoloads
sr-speedbar-autoloads ssh-autoloads tabbar-ruler-autoloads info
tabbar-autoloads textmate-to-yas-autoloads undo-tree-autoloads
visual-regexp-autoloads cl-lib-autoloads yaoddmuse-autoloads
yasnippet-autoloads zenburn-theme-autoloads uniquify ffap url-parse
url-vars saveplace package org warnings ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
org-compat org-macs ob-eval org-loaddefs find-func cal-menu calendar
cal-loaddefs ido tramp tramp-compat auth-source eieio byte-opt bytecomp
byte-compile cconv gnus-util mm-util mail-prsvr password-cache
tramp-loaddefs shell pcomplete comint ansi-color ring format-spec
flyspell rw-hunspell rw-ispell ispell rw-language-and-country-codes
server recentf tree-widget wid-edit easymenu advice help-fns
advice-preload cl-macs gv cl cl-lib time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns
disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process w32 multi-tty emacs)



reply via email to

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